<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>{ Online Notes } &#187; Zend Framework</title>
	<atom:link href="http://www.armando.ws/tag/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.armando.ws</link>
	<description>All things Technical and Personal - Armando Padilla</description>
	<lastBuildDate>Sat, 12 Jun 2010 05:06:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Benchmarking Zend Framework 1.8.4</title>
		<link>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/</link>
		<comments>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 04:11:15 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=406</guid>
		<description><![CDATA[About 2 months ago I sat in on a PHP performance session at work taught by non other than Rasmus Lerdof.  Aside from creating PHP he had some really neat stuff to talk about concerning performance.  Most of the presentation came from the php.net site, talks.php.net. Take a look at the talks when you have [...]]]></description>
			<content:encoded><![CDATA[<p>About 2 months ago I sat in on a PHP performance session at work taught by non other than Rasmus Lerdof.  Aside from creating PHP he had some really neat stuff to talk about concerning performance.  Most of the presentation came from the php.net site, <a href="http://talks.php.net">talks.php.net</a>. Take a look at the talks when you have some time. </p>
<p><strong>The question</strong><br />
Anywho&#8230;that&#8217;s when my benchmarking and optimizing curiosity kicked in.  It wasn&#8217;t until yet another talk at work concerning the benefits of an MVC framework (Symfony) that I started to think about Zend Framework and its performance out of the box (without caching).   So I sat down today and started to benchmark the framework with a simple question in mind, &#8220;How does a simple ZF application compare to an application not using it?&#8221; </p>
<p><strong>The applications</strong><br />
To answer the question I created 3 web projects. The first web project was a static-HTML only application which displayed &#8220;hello world&#8221; on the screen, very simple.  (For those who just want to see the ab results <a href="http://www.armando.ws/projects/zf_benchmark_reading.txt">click here</a>  as well as the <a href="http://www.armando.ws/projects/zf_benchmark_cachegrind.out">Xdebug cachegrind output file</a>.)</p>
<p>The second web project was a single PHP file with the below PHP code.</p>
<p><em>Listing 1.1 &#8211; Simple Hello world PHP</em><br />
<code>&lt;?php echo "hello world"; ?&gt;</code></p>
<p>The above 2 projects acted as my baselines. it would allow me to determine the overhead ZF introduced into the application.</p>
<p>Finally, the third web project was created using ZF&#8217;s Zend Tool and executing the below command.</p>
<p><em>Listing 1.2 &#8211; Zf Project Creation.</em><br />
<code>> zf create project helloworld_zf</code></p>
<p>Finally, I replaced the default index.phtml HTML with the simple PHP code shown in Listing 1.1.  </p>
<p>Yes some may say that these examples are far too simple, but I wanted to test the Framework&#8217;s process to load and what better way to do this than with a very simple example.  I also based it off the talk that was given comparing Symfony.</p>
<p><strong>The Hardware &#038; ab command</strong><br />
Here is the set-up.<br />
1.  Windows machine running Apache 2.2<br />
2.  PHP 5.2.9<br />
3.  Zend Framework 1.8.4<br />
4.  Pentium 4 3.20 GHz<br />
5.  1Gbs of RAM</p>
<p>I used the Apache Benchmark, &#8216;ab&#8217;, tool which comes included with all Apache installation and ran the below command 3 times.</p>
<p>Listing 1.3<br />
<code>&gt; ab -n 1000 -c 5 http://localhost/index.[html|php]</code></p>
<p>The results, for me, were very surprising. I have included all the ab outputs.</p>
<p><strong>Observations</strong><br />
<strong>HTML ONLY &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.344 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  426.67 [#/sec] (mean)<br />
Time per request:       11.719 [ms] (mean)<br />
Time per request:       2.344 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            146.67 [Kbytes/sec] received</p>
<p><strong>HTML ONLY &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.375 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  421.05 [#/sec] (mean)<br />
Time per request:       11.875 [ms] (mean)<br />
Time per request:       2.375 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            144.74 [Kbytes/sec] received</p>
<p><strong>HTML ONLY &#8211; Reading 3</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.344 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  426.67 [#/sec] (mean)<br />
Time per request:       11.719 [ms] (mean)<br />
Time per request:       2.344 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            146.67 [Kbytes/sec] received</p>
<p>Observations:<br />
1.  Roughly 0.0117 seconds per request.<br />
2.  Up to 424.79 requests satisfied per second.</p>
<p><strong>Basic PHP &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.609 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:  383.23 [#/sec] (mean)<br />
Time per request:       13.047 [ms] (mean)<br />
Time per request:       2.609 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            99.93 [Kbytes/sec] received</p>
<p><strong>Basic PHP &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.609 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:  383.23 [#/sec] (mean)<br />
Time per request:       13.047 [ms] (mean)<br />
Time per request:       2.609 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            99.93 [Kbytes/sec] received</p>
<p><strong>Basic PHP &#8211; Reading 3</strong><br />
Concurrency Level:       5<br />
Time taken for tests:    2.625 seconds<br />
Complete requests:      1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:      267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:    380.95 [#/sec] (mean)<br />
Time per request:       13.125 [ms] (mean)<br />
Time per request:       2.625 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          99.33 [Kbytes/sec] received</p>
<p>Observations:<br />
1. There seems to be a 100 request (roughly) drop when supporting PHP.<br />
2. Requests per second satisfied =  382.47 (a drop of 42.32 requests or 9% drop)<br />
3. Time per request = 13.073 or 0.0130 seconds per request (Increase of 11%)</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   68.297 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.64 [#/sec] (mean)<br />
Time per request:       341.484 [ms] (mean)<br />
Time per request:       68.297 [ms] (mean, across a<br />
Transfer rate:          2.82 [Kbytes/sec] received</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   70.281 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.23 [#/sec] (mean)<br />
Time per request:       351.406 [ms] (mean)<br />
Time per request:       70.281 [ms] (mean, across all c<br />
Transfer rate:          2.74 [Kbytes/sec] received</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 3</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   69.656 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.36 [#/sec] (mean)<br />
Time per request:       348.281 [ms] (mean)<br />
Time per request:       69.656 [ms] (mean, across all c<br />
Transfer rate:          2.76 [Kbytes/sec] received</p>
<p>Observations:<br />
Framework not only has a slower response time but also satisfies less requests per second. <strong>Am I doing something wrong????</strong> This cant be correct.</p>
<p>1. Request per second = 15.24 a change of 367.23 requests per second or a drop of 96% between trivial PHP and a ZF power app.<br />
2. Time per request (time taken to satisfy 1 request) = 328.49 ms or 0.328 seconds a change of .315 seconds or an increase of 23%</p>
<p><strong>Conclusion</strong><br />
Even though my benchmarking techniques might be flawed, taking a base line reading with no HTML as well as a very simple PHP script web project allowed me to at least compare.  </p>
<p>Based on these figures (if correct) Zend Framework has a HUGE overheard.  But this should not discourage any would be ZF coder because there are caching techniques which were not used such as using APC and the benefits of a good network admin <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Also the benefits of using any framework far outweigh the drawbacks in my personal opinion.  Where else can you get code which has been tested by the best and packed to contain methods for many of our typical coding requests.</p>
<p>Armando Padilla.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to set up Zend_Tool on Windows.</title>
		<link>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/</link>
		<comments>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/#comments</comments>
		<pubDate>Tue, 19 May 2009 01:17:52 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Tool]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=404</guid>
		<description><![CDATA[A few people we&#8217;re having issues installing Zend_Tool on Windows, hell I was having trouble myself since all of the tutorials out there are either Macs or Red Hat based.  So dont feel bad if your reading this  .  I thought i would take some time and create a tutorial, from the ground up [...]]]></description>
			<content:encoded><![CDATA[<p>A few people we&#8217;re having issues installing Zend_Tool on Windows, hell I was having trouble myself since all of the tutorials out there are either Macs or Red Hat based.  So dont feel bad if your reading this <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .  I thought i would take some time and create a tutorial, from the ground up and learn a few things myself along the way.  So here we go!</p>
<p><strong>Step one Installing PHP (if you havent yet)</strong><br />
If you have PHP already installed skip this section and head over to &#8220;An overview of the installation&#8221;.  Eeryone else, head over to the PHP site,  <a href="http://www.php.net">php.net</a> and download the latest and greatest. As of this writing the latest Windows installer is php-5.2.9-2 msi.  Download the executable.  Yea so what I use executable and you should too its easier to install and configure on Windows.<br />
Once the file downloads, double click the installer, click &#8220;next&#8221; a few times, and stop when you reach the &#8220;Choose Items to Install&#8221;.</p>
<p><strong><img class="alignleft size-medium wp-image-411" style="margin: 5px;" title="choose_items" src="http://www.armando.ws/wp-content/uploads/2009/05/choose_items-300x235.jpg" alt="choose_items" width="300" height="235" /></strong><strong>Choose Items to Install</strong><br />
Once you reach this point your going to check off which extensions you want installed.  By default the installer has a few modules turned off but you can easily turn them on by checking off the items to install.  Make sure that the &#8220;CLI Executable&#8221; has no red x marks next to it as shown in the neat picture to the left.   If it does click on the &#8220;X&#8221; and select,  &#8220;Will be installed on local hard drive&#8221;.  By doing this your going to installed the php.exe file as well as allow the executable to automatically update and create System Variables. Click &#8220;Next&#8221;, then &#8220;Install&#8221; and watch it go.</p>
<p><img class="alignright size-full wp-image-410" style="margin: 5px;" title="system_var" src="http://www.armando.ws/wp-content/uploads/2009/05/system_var.jpg" alt="system_var" width="268" height="302" /></p>
<p><strong>An overview of the Installation and Required System Variables</strong><br />
When the installation is done you should have a new directory, C:\Program Files\PHP (if you didnt change the default location).  This contains the php.exe file along with a number of other things.   You should also have some updates to your environment variables.  Open the Environment Variables window by right clicking on &#8220;My Computer&#8221; , &#8220;Properties&#8221;,  &#8220;Advanced&#8221;, &#8220;Environment Variables&#8221; .  At the bottom of the window you should have 2 System Variables, &#8220;Path&#8221; and &#8220;PHPRC&#8221;.  Make sure &#8220;Path&#8221; contains the &#8220;C:\Program Files\PHP\;&#8221;  (Replace with the location of your PHP directory) and make sure PHPRC contains, &#8220;C:\Program Files\PHP\&#8221; (Location to your php.ini file) .    If all the variables are set click &#8220;Ok&#8221; and head onto the next section.</p>
<p><strong>Verifying Installation.</strong><br />
Now to check that the installation went smoothly.  Open a command line window.  You do this by going to &#8220;Start&#8221;, &#8220;Run&#8221;, and then typing in &#8220;cmd&#8221;, then click &#8220;Ok&#8221;.  Once the command line window appears type in:  php &#8211;version</p>
<p>You should see:</p>
<p><img class="alignnone size-full wp-image-414" title="php_version" src="http://www.armando.ws/wp-content/uploads/2009/05/php_version.jpg" alt="php_version" width="640" height="103" /></p>
<p><strong></strong></p>
<p>If you do great!  Your done with PHP. Let&#8217;s install Zend Framework now.</p>
<p><strong>Installing Zend_Tool</strong><br />
If all went well,  now its time to install Zend_Tool. Download the latest Zend Framework (latest is 1.8.1)  and extract the files somewhere onto your system.   Move the files</p>
<ul>
<li>bin/zf.php</li>
<li>bin/zf.bat</li>
</ul>
<p>into the directory C:\Program Files\PHP and place all the content of the library folder into the C:\zf directory.  Many tutorials recommend installing the library in your PHP includes directory but I decided to install it under C:\zf to demonstrate how to use ZEND_TOOL_INCLUDE_PATH environment variable since the library can practically live anywhere when your developing sites.    The full path to your Zend Framework instillation is now, C:\zf\library\Zend.</p>
<p><strong>Setting up ZEND_TOOL_INCLUDE_PATH</strong><br />
Open the Environment Variable window again and create a new environment variables under the &#8220;System Variables&#8221;  section.   In the &#8220;Variable Name&#8221;  text field enter, &#8220;ZEND_TOOL_INCLUDE_PATH&#8221;  and in the &#8220;Variable Value&#8221; text field enter &#8220;C:\Program Files\PHP\includes\library\&#8221;  (path to the Zend Library minus the Zend portion).   Click ok to close out the &#8220;New System Variable&#8221; window and then click &#8220;ok&#8221; once again to close the &#8220;Environment Variable&#8221; wndow.  Time to check if Zend_Tool works.</p>
<p><strong>Verify Installation</strong><br />
If you have any command line windows open, close them and then reopen one.   Type in <em>zf show version</em> you should see the below:</p>
<p><strong><img class="alignnone size-full wp-image-417" title="zf_command" src="http://www.armando.ws/wp-content/uploads/2009/05/zf_command.jpg" alt="zf_command" width="640" height="61" /><br />
</strong></p>
<p><strong>Useful commands.</strong><br />
Your set to create your projects , controller, actions now. Below I added a few commands I tend to use.</p>
<p><em>Create Project</em><br />
zf create project helloworld</p>
<p><em>Create a new controller</em> (below commands must be issued within project directory)<br />
zf create controller controller1<br />
zf create controller controller2</p>
<p><em>Create a few actions</em><br />
zf create action action1 controller1<br />
zf create action action2 controller2</p>
<p>Thats it!<br />
Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.8 Released</title>
		<link>http://www.armando.ws/2009/05/zend-framework-18-released/</link>
		<comments>http://www.armando.ws/2009/05/zend-framework-18-released/#comments</comments>
		<pubDate>Mon, 04 May 2009 04:54:30 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Tool]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=382</guid>
		<description><![CDATA[Last week ZF 1.8 was released and this weekend I spent the better part of it looking through the documentation and over a few of the items released within this package.  A few standouts include:

Zend_Tool
Zend_Tag
The Cloud computing components

For more information heres the complete list of features released.   I also had a questions for [...]]]></description>
			<content:encoded><![CDATA[<p>Last week ZF 1.8 was released and this weekend I spent the better part of it looking through the documentation and over a few of the items released within this package.  A few standouts include:</p>
<ol>
<li>Zend_Tool</li>
<li>Zend_Tag</li>
<li>The Cloud computing components</li>
</ol>
<p>For more information <a href="http://devzone.zend.com/article/4524-Zend-Framework-1.8.0-Released" target="_blank">heres</a> the complete list of features released.   I also had a questions for the Zend folks regarding Zend Tool on the page.   <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Coming up I plan to take a stab at Zend_Tool_Framework_Provider and create a simple example on how use and implement.</p>
<p>Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/05/zend-framework-18-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to run Zend Framework with no .htaccess file.</title>
		<link>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/</link>
		<comments>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 06:01:32 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Set-Up]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=337</guid>
		<description><![CDATA[Work has been overwhelming lately and frustrating but there was an interesting question asked by one of the developers at work.  Can the Zend Framework run without the .htaccess file?  The answer, Yes.

Why do we need the .htaccess file
First off why is the .htaccess file required in the first place by Zend Framework?  Think of [...]]]></description>
			<content:encoded><![CDATA[<p>Work has been overwhelming lately and frustrating but there was an interesting question asked by one of the developers at work.  Can the Zend Framework run without the .htaccess file?  The answer, Yes.<br />
<strong><br />
Why do we need the .htaccess file</strong><br />
First off why is the .htaccess file required in the first place by Zend Framework?  Think of the .htaccess file as a funnel.<br />
In a funnel, you poor water/liquid/stuff into the end contaning the larger diameter. The &#8220;stuff&#8221; is then squeezed out of a small single point at the opposite end. In the web world the &#8220;stuff&#8221; is web traffic and the the single point is where all the traffic goes through, in this case its the .htaccess file. </p>
<p>The .htaccess file will send all incoming traffic to your Front Controller which handles routing and dispatching etc.</p>
<p><strong>Removing .htaccess from the process.</strong><br />
For this im going use Apache 2.2. Start off by opening up the httpd.conf file located in the the conf folder of your Apache installation. Somewhere near the bottom add the following lines.</p>
<p><code>#Application Specific Include file<br />
Include conf/extra/httpd-zf.conf</code></p>
<p>This will allow Apache to add addition configuration settings once Apache is restarted and its a great place to isolate application specific Apache settings.</p>
<p>Now, go ahead an create the include file, &#8220;httpd-zf.conf&#8221; inside the APACHE_HOME/conf/extra/ directory and place the ReWrite rules which were originally in your .htaccess file into<br />
it.  Hit save, remove the .htaccess file, and restart Apache.  You should see your Zend Framework application running.</p>
<p><strong>Why do this?</strong><br />
Speed.  Your application must always read the .htaccess file when someone visits the site.  Removing this extra layer and placing it into the Web Server itself will reduce the amount of time a page loads.</p>
<p>Hope that helps someone out there <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend Framework and JQuery UI &#8211; Adding JQuery UI Widgets using ZendX_JQuery.</title>
		<link>http://www.armando.ws/2009/01/zend-framework-and-jquery-ui-adding-jquery-ui-widgets-using-zendx_jquery/</link>
		<comments>http://www.armando.ws/2009/01/zend-framework-and-jquery-ui-adding-jquery-ui-widgets-using-zendx_jquery/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 04:56:34 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Framework Extension]]></category>
		<category><![CDATA[ZendX_JQuery]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=291</guid>
		<description><![CDATA[With the release of the new Zend Framework 1.7.3 a few nuggets were released.  One of those nuggets was the extension support for JQuery UI Widgets.  Featuring Dialog, Tabs, and Date Selection widgets among other bug fixes.  (A full list of updated Zend 1.7.3 release notes can be seen here)
With the release I started to [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of the new Zend Framework 1.7.3 a few nuggets were released.  One of those nuggets was the extension support for JQuery UI Widgets.  Featuring Dialog, Tabs, and Date Selection widgets among other bug fixes.  (A full list of updated Zend 1.7.3 release notes can be seen <a href="http://devzone.zend.com/article/4196-Zend-Framework-v1.7.3-Released" target="_blank">here</a>)</p>
<p>With the release I started to dig into my current projects and started to update my forms.  Adding widgets here and there.   In the process I learned  thing or two and just wanted to share.</p>
<p><strong>Outline</strong><br />
What are we going to cover?</p>
<ul>
<li>All required Files and packages.</li>
<li>Installation of these files and packages</li>
<li>Examples &#8211; Dialog, DatePicker Widgets as well as their API.</li>
<li>Links to helpful readings</li>
</ul>
<p><strong>Required Files</strong><br />
If you havent download the latest release, 1.7.3, do so now (<a href="http://framework.zend.com/download/latest/" target="_blank">click her</a>).  Once your done downloading unzip the filea nd open the directory <em>extras/library</em>.  This is the directory which contains  the <em>ZendX</em> folder.</p>
<p>The latest Zend Framework release comes with an additional library, ZendX. These are extensions which are not part of the Core of the framework.  Currently the library contains 2 componenets;  the JQuery and the Console components.</p>
<p>Copy the <em>ZendX</em> folder into the folder which contains your current installation of the Zend library. On my webserver the directory structure looks like this after I copy ZenX into the directory . (Yes</p>
<p style="text-align: center;"><img class="size-full wp-image-294 aligncenter" title="dir_structure" src="http://www.armando.ws/wp-content/uploads/2009/01/dir_structure.bmp" alt="dir_structure" width="207" height="77" /></p>
<p>You now need the JQuery UI library. To take advantage of the latest and greatest your going to need the release candidate (<a href="http://jquery-ui.googlecode.com/files/jquery.ui-1.6rc6.zip" target="_blank">jquery 1.6rc6</a>), download it and unzip it.</p>
<p>Place the files</p>
<ul>
<li>themes</li>
<li>ui</li>
<li>external</li>
<li>jquery-1.3.1.js</li>
</ul>
<p>inside your public directory. Your final directory structure should look something similar to this:</p>
<p style="text-align: center;"><img class="size-full wp-image-300 aligncenter" title="final_js_dir" src="http://www.armando.ws/wp-content/uploads/2009/01/final_js_dir.bmp" alt="final_js_dir" width="141" height="121" /></p>
<p>Required Files are now installed.<br />
<strong>Identifying ZendX_JQuery to your Zend Application</strong><br />
Since the ZendX_JQuery is a View_Helper extension and not part of the main library we need to register it as a plugin using the Zend_View <em>addHelperPath() </em>method.</p>
<p>Open your bootstrap file. <em>public/index.php</em> and copy the below script into it.</p>
<p><code>$view = new Zend_View();<br />
$view-&gt;addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');<br />
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();<br />
$viewRenderer-&gt;setView($view);<br />
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);</code></p>
<p>Adding the information to the bootstrap file will allow you to use the <em>ZendX_JQuery</em> throughout your application. From now on the only item you need to include in your View are the styleSheet to implement using the jQuery() addStylesheet()<br />
method and the jQuery() setUriLocalPath() method in your View.</p>
<p>The addStylesheet method will add the stylesheet.  If your setup is identical to one shown above you can use the string  &#8220;/js/themes/base/ui.all.css&#8221;  to refernce the css file required. (ZF reference manual mentions flora css, i could not find it)</p>
<p>The setURiLocalPath() will add the js library to use.  Set it to &#8220;/js/ui/jquery.ui.all.js&#8221;.</p>
<p>Well get to see how to use these jQuery methods now.</p>
<p><strong>Putting the pieces together &#8211; Examples<br />
</strong>Were going to implement 2 quick examples which will get us started on the right foot by implementing a Date-Picker and a Dialog.</p>
<p><strong> Date Picker</strong><br />
The first example demonstrates the use of the View Helper DatePicker.<br />
The full method accepts 4 parameters with the third parameter accepting an array containing options shown <a href="http://docs.jquery.com/UI/Datepicker/datepicker#options" target="_blank">here</a>.</p>
<p>datePicker(id, default_value_to_display_in_text_field, params, attributes)</p>
<p>Lets take a look at our View.</p>
<p><code><br />
</code></p>
<p>jQuery()-&gt;addStylesheet(&#8217;/js/themes/base/ui.all.css&#8217;);?&gt;</p>
<p><label for="startDate">Birth Day:</label><br />
datePicker(&#8221;startDate&#8221;,<br />
&#8216;Select Your Birth Day&#8217;,<br />
array(&#8217;defaultDate&#8217; =&gt; &#8216;+7&#8242;,<br />
&#8216;minDate&#8217; =&gt; &#8216;+7&#8242;,<br />
&#8216;dateFormat&#8217; =&gt; &#8216;mm-dd-yy&#8217;)); ?&gt;</p>
<p>jQuery()-&gt;setUiLocalPath(&#8221;/js/ui/jquery.ui.all.js&#8221;);?&gt;</p>
<p>The example shown above adds the stylesheet between the head node and places the js file at the very end of our HTML.  Placing the js at the very end of the body is critical to do.  Placing it anywhere else will  cause mixed results when executing Ajax features.</p>
<p>The example above also demonstrates how to format the date for the specific field using one of the parameters.   Go ahead and give it a try, you should see something like the below figure.</p>
<p style="text-align: center;"><img class="size-full wp-image-303 aligncenter" title="datepicker" src="http://www.armando.ws/wp-content/uploads/2009/01/datepicker.bmp" alt="datepicker" width="426" height="305" /></p>
<p><strong>Dialog Boxes</strong><br />
A dialog box is the Web 2.0 equivalent of the alert() javascript popup. Using the dialogContainer method we can add a dialog box to our page. Below is an example of a dialog box which uses parameters.</p>
<p>If you tried the example in the ZF Reference manual and didn&#8217;t have this work for you. Dont worry, change &#8216;dialog&#8217; to &#8216;dialogContainer&#8217; and you should be able to get it working.</p>
<p><code><br />
</code></p>
<p>jQuery()-&gt;addStylesheet(&#8217;/js/themes/base/ui.all.css&#8217;);?&gt;</p>
<p>dialogContainer(&#8221;dialog1&#8243;,<br />
&#8216;Welcome to the ZendX_JQuery World!&#8217;, array(&#8217;draggable&#8217; =&gt; true,<br />
&#8216;modal&#8217; =&gt; true,<br />
&#8216;resizable&#8217; =&gt; true,<br />
&#8216;title&#8217; =&gt; &#8216;Welcome message&#8217;,<br />
&#8216;closeOnEscape&#8217; =&gt; true)); ?&gt;</p>
<p>jQuery()-&gt;setUiLocalPath(&#8221;/js/ui/jquery.ui.all.js&#8221;);?&gt;<br />
For additional parameters available for the dialogContainer take a look at the JQuery API for the UI widget <a href="http://docs.jquery.com/UI/Dialog/dialog#options" target="_blank">here</a>.  Try out the View, you should see the Dialog window shown below.</p>
<p><img class="aligncenter size-full wp-image-305" title="zendx_jquery_dialogcontainer" src="http://www.armando.ws/wp-content/uploads/2009/01/zendx_jquery_dialogcontainer.bmp" alt="zendx_jquery_dialogcontainer" /></p>
<p>Thats it. Set up is done, you know the requirements for the JQuery UI Widgets, and you created 2 widgets.  Take a look at some of the links below that helped me get started.</p>
<p>There are a few quarcks i havent figured out yet such as the inability to move the dialog box using FF 3 and currently playnig around with the other widgets so Ill update as I go.  Next on the docket.  Progress bar and File Uploading using Jquery extension.</p>
<p><strong>Helpful Links</strong></p>
<ul>
<li><a href="http://framework.zend.com/manual/en/zendx.jquery.html" target="_blank">ZendX_JQuery &#8211; Full Refrence Page.<br />
</a></li>
<li><a href="http://ui.jquery.com/" target="_blank">JQuery UI Home Page</a></li>
<li><a href="http://docs.jquery.com/UI#Widgets" target="_blank">JQuery Widget API</a> (used for the $param parameter for each JQuery View_Helper Widget)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/01/zend-framework-and-jquery-ui-adding-jquery-ui-widgets-using-zendx_jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Zend_Paginator doesnt work :-(</title>
		<link>http://www.armando.ws/2009/01/zend_paginator-doesnt-work/</link>
		<comments>http://www.armando.ws/2009/01/zend_paginator-doesnt-work/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 01:22:59 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Paginator]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=277</guid>
		<description><![CDATA[This will be a quick entry.  Are you having issues using the Zend_Paginator view functions?  Yea me too.   This affects all releases and isnt really a bug but more of a annoyance if you dont know whats going on.  
What is the issue?
Well if you installed a fresh copy of [...]]]></description>
			<content:encoded><![CDATA[<p>This will be a quick entry.  Are you having issues using the Zend_Paginator view functions?  Yea me too.   This affects all releases and isnt really a bug but more of a annoyance if you dont know whats going on.  </p>
<p><strong>What is the issue?</strong><br />
Well if you installed a fresh copy of PHP or if you prefer to code with &lt;?php ?&gt;  open and close tags appose to &lt;? ?&gt; you might be affected.   Since a fresh copy of PHP contains the PHP.ini flag short_open_tags = Off this causes some chaos and doesnt allow the Zend_Paginator::paginationControl function for example as well as $this->next $this->previous attributes to not work in a View. </p>
<p>T<strong>he Fix</strong><br />
Open your php.ini file. You can check which php.ini your using by using phpinfo(); and check the Currently Loaded php.ini path.  open the file up and set the short_open_tags flag to On then restart Apache.  </p>
<p>You should see it work.  TADA!</p>
<p>Armando Padilla &#8211; Time to get some dinner.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/01/zend_paginator-doesnt-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend_Service_Netflix Release 1 Available.</title>
		<link>http://www.armando.ws/2008/11/zend_service_netflix-release-1-available/</link>
		<comments>http://www.armando.ws/2008/11/zend_service_netflix-release-1-available/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 22:40:35 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=257</guid>
		<description><![CDATA[So about a month after initially starting on the code, I finally released two versions of the Zend_Service_Netflix wrapper for the Zend Framework, submitted a proposal to the Zend Framework Team, and changed the status on my proposal from &#8220;New&#8221; to &#8220;Ready for Review&#8221;.  Pheww was that hard work put to good use.  It feels [...]]]></description>
			<content:encoded><![CDATA[<p>So about a month after initially starting on the code, I finally released two versions of the Zend_Service_Netflix wrapper for the Zend Framework, submitted a proposal to the Zend Framework Team, and changed the status on <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Netflix-Armando+Padilla" target="_blank">my proposal</a> from &#8220;New&#8221; to &#8220;Ready for Review&#8221;.  Pheww was that hard work put to good use.  It feels good to get this off and running with the initial release.</p>
<p><strong>What&#8217;s included in the release?</strong><br />
Like I mentioned before i created 2 releases.  One release contains only the catalog functionality.  It allows developers to use title search, title auto complete which can be used in conjunction with AJAX to create a autocomplete search box, retrieve detailed title information, and search actors/directors.  This package is intended for developers that want to use the extensive Netflix catalog on their own web site without the added functionality found in the full version of the release.</p>
<p>The second release, the FULL release, contains not only the catalog functionality but also allows developers to manage user queues, manage user ratings, retrieve user reviews, and most importantly create the request access url, the URL which users NEED to click that allows their app to retrieve restricted content.  So if the developer wanted to create a Zend Framework powered app that allowed users to add, delete, and update their &#8220;Watch Queue&#8221; or &#8220;Instant Watch Queue&#8221; they can do this by calling a simple method within this package.</p>
<p><strong>Where can i get the release?</strong><br />
I committed the releases to the Google Code site Located here, <a href="http://code.google.com/p/zendframeworknetflixservice/downloads/list" target="_blank">Zend Framework Netflix</a>.  The packages are properly named so you wont have trouble distinguishing which one you need.</p>
<p><strong>Whats next?<br />
</strong>The next steps for this project is to have the Zend Framework team review some of the code, my submitted outline, and hopefully approve it.  On my end I will continue to work on the code.  There are 2 items which i need to iron out, Updating Ratings, Deleting an Item from the users Queue, and updating the code to support the SIGNITURE METHOD HMAC-SHA1.  I will place these items and other &#8220;gotchas&#8221; on the google code twiki to continue to track my progress.  I will also clean up my PHPUnit tests.</p>
<p>I would like to also create a small set of examples for the user to refer to, as well as a small application users can see the code in use. Again i will provide the details on the google code twiki and here as well.</p>
<p>I&#8217;m anxious to hear back from anyone that&#8217;s using it how i can improve on it and what they think is a better approach.</p>
<p>Armando Padilla</p>
<p><strong>Links of interest?  Maybe?</strong></p>
<ul>
<li><a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Netflix-Armando+Padilla" target="_blank">Zend Proposal &#8211; has examples you can use to run the code under &#8220;Use cases&#8221;.</a></li>
<li><a href="http://code.google.com/p/zendframeworknetflixservice/" target="_blank">Zend Framework Netflix Service Google Code Twiki.</a></li>
<li><a href="http://code.google.com/p/zendframeworknetflixservice/downloads/list" target="_blank">Zend Framework Netflix Service Download Page.</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2008/11/zend_service_netflix-release-1-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework &amp; Netflix &#8211; Zend_Service_Netflix</title>
		<link>http://www.armando.ws/2008/10/zend-framework-and-netflix-zend_service_netflix/</link>
		<comments>http://www.armando.ws/2008/10/zend-framework-and-netflix-zend_service_netflix/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 08:24:14 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend_service_netflix]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=255</guid>
		<description><![CDATA[I popped on the headphones, slipped a Thievery Corporation track and started to read the new Netflix REST API. A few hours later and a mad rush to code, I created a pre-pre-pre-pre-alpha release package for the Zend Framework.  It&#8217;s a rough implementation that has much to be done to it and has not been [...]]]></description>
			<content:encoded><![CDATA[<p>I popped on the headphones, slipped a <a href="http://www.imeem.com/nataliewalker/music/NZR8oXug/natalie_walker_quicksand_thievery_corporation_remix/" target="_blank">Thievery Corporation track</a> and started to read the new Netflix REST API. A few hours later and a mad rush to code, I created a pre-pre-pre-pre-alpha release package for the Zend Framework.  It&#8217;s a rough implementation that has much to be done to it and has not been flushed out that well. It currently supports only one REST call, &#8220;/catalog/title&#8221;, but I have plans to support the entire gambit of REST calls open by Netflix for this package.</p>
<p>For those interested in the <a href="http://developer.netflix.com/page">netflix api check this page out</a>.  It&#8217;s basically the netflix documentation. Its pretty straight-forward and should be an easy and fun read.  I was surprised they opened up their &#8216;predicted rating&#8217; api. Nice touch <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I can see A LOT of things developers can do with just the prediction REST api.</p>
<p>And for those that want to check out the Zend_Service_Netflix code i currently have, here is the <a href="http://code.google.com/p/zendframeworknetflixservice/">Google Code Project Page</a> link.  </p>
<p>I plan to finish the package by Sunday evening.  Here is my attack plan.</p>
<p><strong>Attack Plan:</strong></p>
<ol>
<li>Finish the concrete classes. (ETA Friday evening) </li>
<li>Finish Up the remaining REST calls (ETA Saturday Evening)</li>
<li>Create test using PHPUnit. (ETA. as I go)</li>
<li>Documentation.  (ETA Sunday evening) </li>
</ol>
<div><strong>Links:</strong><br />
<a href="http://code.google.com/p/zendframeworknetflixservice/" target="_blank">Zend Service Nerflix download package</a> (my version)</div>
<div><a href="http://developer.netflix.com/page" target="_blank">Netflix API URL</a></div>
<div><a href="http://framework.zend.com/" target="_blank">Zend Framework URL </a> <br />
 </div>
<div>Ok so its like almost 2am and spent all evening reading and coding ill have move updates tomorrow evening.</div>
<div>
<p>Armando Padilla<br />
PS.  Yes i know, the code looks like ass..sue me (no don&#8217;t that would suck) I did all that in a few (3) hours. </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2008/10/zend-framework-and-netflix-zend_service_netflix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend_Paginator and Your Result Set.</title>
		<link>http://www.armando.ws/2008/10/zend_paginator-and-your-result-set/</link>
		<comments>http://www.armando.ws/2008/10/zend_paginator-and-your-result-set/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 07:15:02 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Pagination]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Db]]></category>
		<category><![CDATA[Zend_Db_Select]]></category>
		<category><![CDATA[Zend_Paginator]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=254</guid>
		<description><![CDATA[The day was cloudy, it rained last night (i love rain), so it placed me into one of those, &#8220;damn about time&#8221;, moods.  Then I popped open Chrome and came to one of my usual stomping grounds on the net.  I clicked on the thread. Read how a few people were having an issue I [...]]]></description>
			<content:encoded><![CDATA[<p>The day was cloudy, it rained last night (i love rain), so it placed me into one of those, &#8220;damn about time&#8221;, moods.  Then I popped open Chrome and came to one of my usual stomping grounds on the net.  I clicked on the thread. Read how a few people were having an issue I grappled with earlier when dealing with Zend_Paginator and decided to write. The issue, How to use the Zend_Paginator on a database result set without having to fetch ALL of the records.</p>
<p><strong>What is the Pagination?  </strong><br />
A bit of an intro. What&#8217;s Pagination.  Pagination is simply a way in which developers allow users visiting a site to scroll through a long list of records be it 10 at at time, 100 at a time, or &lt;your arbitrary number here&gt; at a time.  Im sure you&#8217;ve seen it around the web but might not have called it by the fancy-smancy &#8220;Pagination&#8221; name.  Hell I call it, &#8220;that next and previous button thinggie&#8221;, or &#8220;that 1 2 3 4 5 page selector stuff&#8221;.  Lets continue. </p>
<p>Pagination used to be an tedious but necessary task for developers.  I wont go into al the steps to create your own custom pagination code base but let me just tell you it sucked. Thank you Zend_Paginator for less stress in my life.</p>
<p><strong>Zend_Paginator a public service announcement.</strong><br />
In its newest installment, Zend Framework 1.6, the developers at Zend added in a pagination component, Zend_Paginator.  This allowed developers like you and me to create Pagination features on the fly (it took me 1 minute to implement when i timed it)  Lets take a quick example.</p>
<p>&lt;?php<br />
require_once &#8220;Zend/Loader.php&#8221;;<br />
Zend_Loader::loadClass(&#8221;Zend_Paginator&#8221;);</p>
<p>//Intialize records.  This is what th user will paginate through.<br />
$myRecords = array(&#8221;Armando Padilla&#8221;,<br />
&#8220;Monica R.&#8221;,<br />
&#8220;Elisa P.&#8221;,<br />
&#8220;Francisca P.&#8221;,<br />
&#8220;Guillermo P.&#8221;,<br />
&#8220;Some awesome person in my family&#8221;);</p>
<p>//Create Paginator Object<br />
$Paginator = Zend_Paginator::factory($myRecords);</p>
<p>//Set the current page were on.<br />
$Paginator-&gt;setCurrentPageNumber($currentPage);</p>
<p>//Set the number of records to show per page<br />
$Paginator-&gt;setItemCountPerPage(3);</p>
<p>//Save Paginator as View var.<br />
$this-&gt;view-&gt;paginator = $Paginator;<br />
?&gt;</p>
<p>Going through the code above, we initialize our array of records which will be paginated by the user in the variable $myRecords.  I then create a Zend_Paginator object and pass in $myRecords into the factory method.  The Zend Framework then hooks everything else up for us behind the scenes and all we have to do is make sure we pass in the $currentPage the user is currently on and display the pagination links on our page.  </p>
<p><strong>The Problem<br />
</strong>So wheres the problem?  Well the problem lies in how users of the Zend_Paginator object are using it.  Many developers are using the Zend_Paginator object with database records errounously.  They hit the database, return ALL the records, store them into memory, and then allow Zend_Paginator to handle these potential HUGE record sets in the backend. Bleh  </p>
<p><em>Wrong way of doing it Example:</em></p>
<p><em><span style="font-style: normal;"> &lt;?php<br />
require_once &#8220;Zend/Loader.php&#8221;;<br />
Zend_Loader::loadClass(&#8221;Zend_Paginator&#8221;);</span></em></p>
<p><em><span style="font-style: normal;">//Initialize of DB object<br />
$db = new Zend_Db::factory() //Paraphrasing here.<br />
$statement = &#8220;SELECT * FROM Player&#8221;;<br />
$myRecords = $db-&gt;fetchAll($statement);</span></em></p>
<p><em><span style="font-style: normal;">//Create Paginator Object<br />
$Paginator = Zend_Paginator::factory($myRecords);</span></em></p>
<p><em><span style="font-style: normal;">//Set the current page were on.<br />
$Paginator-&gt;setCurrentPageNumber($currentPage);</span></em></p>
<p><em><span style="font-style: normal;">//Set the number of records to show per page<br />
$Paginator-&gt;setItemCountPerPage(3);</span></em></p>
<p><em><span style="font-style: normal;">//Save Paginator as View var.<br />
$this-&gt;view-&gt;paginator = $Paginator; <br />
?&gt;<br />
</span></em></p>
<p>Very inefficient.  </p>
<p><strong>The Solution</strong><br />
We don&#8217;t have to select ALL the records in the Db but allow Zend_Paginator to select and use small manageable pieces at a time for us.  How?  If we had a table with 1000000 records we dont have to select all records but construct a Zend_Db_Select object with the appropriate criteria, and then pass that into the factory instead of the array.  Lets take a look how this is done using the same Players table.</p>
<p><em>The right way of doing it</em></p>
<p>&lt;?php<br />
require_once &#8220;Zend/Loader.php&#8221;;<br />
Zend_Loader::loadClass(&#8221;Zend_Paginator&#8221;);</p>
<p>//Initialize of DB object<br />
Zend_Loader::loadClass(&#8221;Zend_Db&#8221;);<br />
$db = new Zend_Db::factory() //Paraphrasing here. </p>
<p>//Create Select Object<br />
Zend_Loader::loadClass(&#8221;Zend_Db_Select&#8221;);<br />
$selectStatement = $db-&gt;select()-&gt;from(&#8221;Players&#8221;);</p>
<p>//Create Paginator Object<br />
$Paginator = Zend_Paginator::factory($selectStatement);</p>
<p>//Set the current page were on.<br />
$Paginator-&gt;setCurrentPageNumber($currentPage);</p>
<p>//Set the number of records to show per page<br />
$Paginator-&gt;setItemCountPerPage(3);</p>
<p>//Save Paginator as View var.<br />
$this-&gt;view-&gt;paginator = $Paginator;<br />
?&gt;</p>
<p>Thats all there is too it.  Less memory consumption because we dont have fetch ALL our records at a time and allows the Zend Framework to do the heavy lifting for us. Hope this helps a few people looking for the answer to this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2008/10/zend_paginator-and-your-result-set/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A step back?</title>
		<link>http://www.armando.ws/2008/04/a-step-back/</link>
		<comments>http://www.armando.ws/2008/04/a-step-back/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 18:08:05 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[savant]]></category>
		<category><![CDATA[smarty]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend_form]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=183</guid>
		<description><![CDATA[Like most of you know I&#8217;ve been interviewing with a few companies lately and during one of the interviews the interviewer expressed something to me that i thought I was the only one thinking.  My thought, &#8220;wow i totally know what you mean&#8230;but i shouldn&#8217;t agree with you because you might think im kissing [...]]]></description>
			<content:encoded><![CDATA[<p>Like most of you know I&#8217;ve been interviewing with a few companies lately and during one of the interviews the interviewer expressed something to me that i thought I was the only one thinking.  My thought, &#8220;wow i totally know what you mean&#8230;but i shouldn&#8217;t agree with you because you might think im kissing your ass to get the job&#8221;.  We were talking about the Zend_Form library of the Zend framework.</p>
<p>The Zend_Form component allows developers to use helpers to create forms.  This is much like the form helpers for Ruby on Rails.  It has a selector helper, password helper and all the form types that someone might eventually use in a form.  With all these positive tools what on earth might be my grip with the Zend_Form?  Easy, html/xhtml shouldn&#8217;t be handled why a backend developer.  With this component we basically take a step back from keeping html/designers away from the backend and backend developers away from taking on another responsibility, creating dynamic forms.</p>
<p><a href="http://smarty.php.net" target="_blank">Smarty</a>, <a href="http://phpsavant.com/yawiki/" target="_blank">Savant</a>, and the basic mvc pattern was set up to facilitate the need to keep such separations intact.  HTML coders wouldn&#8217;t want to deal with PHP code, so nice looking template libraries such as Smarty and Savant were created to hide these tags from HTML.  Now with the introduction of Zend_Form, this idea goes out the window.  I&#8217;m not implying that Zend_Form isnt a good thing, but is it a necessary component? As developers,  we have already crossed this delimma in the architect web road.  The outcome? We realized that separation is best.</p>
<p>Could the Zend_Form library have been created to compete with Ruby on Rails?</p>
<p>Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2008/04/a-step-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
