<?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>KILLERPHP.COM &#187; Zend-Framework</title>
	<atom:link href="http://www.killerphp.com/articles/category/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.killerphp.com/articles</link>
	<description>Dedicated to teaching web designers PHP.</description>
	<lastBuildDate>Thu, 11 Mar 2010 21:46:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Trend is Zend &#8230; in PHP</title>
		<link>http://www.killerphp.com/articles/the-trend-is-zend-in-php/</link>
		<comments>http://www.killerphp.com/articles/the-trend-is-zend-in-php/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 00:24:56 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Advanced PHP]]></category>
		<category><![CDATA[Editorial]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/?p=543</guid>
		<description><![CDATA[
Hi,
People ask me from time to time, what PHP framework is the best one to learn?
Well, I always look at technology choices with two things in mind:

How capable is the technology?
How accepted is the technology?

If you look around, it becomes pretty clear, that if you want to learn an effective web application framework, you want [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" alt="zend framework logo" title="zend framework logo" width="227" height="58" class="alignright size-full wp-image-100" /></p>
<p>Hi,</p>
<p>People ask me from time to time, what PHP framework is the best one to learn?</p>
<p>Well, I always look at technology choices with two things in mind:</p>
<ol>
<li>How capable is the technology?</li>
<li>How accepted is the technology?</li>
</ol>
<p>If you look around, it becomes pretty clear, that if you want to learn an effective web application framework, you want to learn the <a href="http://www.killerphp.com/zend-framework/">Zend Framework</a> &#8211; indeed, the <a href="http://www.killerphp.com/articles/php-video-why-zend-instead-of-other-php-framework/">trend is with Zend</a>.</p>
<p><strong>Zend framework being used by companies large and small</strong></p>
<p>I know from first-nerd experience that the Zend Framework is being widely adopted. Just recently for example, Intuit and the BBC have implemented new web apps that are Zend Framework based.</p>
<p>&#8230; I know because my good buddy Jon Lebensold of <a href="http://www.zendcasts.com/">Zendcasts</a> helped build one of them. </p>
<p>There are plenty of other examples out there I&#8217;m sure &#8230; and I am confident that the trend will continue towards the adoption of the Zend Framework. With the PHP company (Zend) and IBM behind it &#8230; it doesn&#8217;t take a brain surgeon to figure that one out.</p>
<p>Thanks for reading,</p>
<p>Stefan Mischook<br />
www.killerphp.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/the-trend-is-zend-in-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Two thumbs up for the Zend Framework Nerds.</title>
		<link>http://www.killerphp.com/articles/two-thumbs-up-for-the-zend-framework-nerds/</link>
		<comments>http://www.killerphp.com/articles/two-thumbs-up-for-the-zend-framework-nerds/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 03:33:59 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Zend-Framework]]></category>
		<category><![CDATA[php podcast]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/?p=524</guid>
		<description><![CDATA[
Hi,
I&#8217;ve been busy with things and so not too many updates lately. Not to worry thought, we have a brand new course and lots of free videos coming out soon on advanced MySQL.
In the following podcast (it was a video but I changed my mind &#8230;), I talk about the pragmatism of the Zend Framework [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.killerphp.com/articles/wp-content/uploads/2010/01/085.png" alt="microphone-podcast-icon" title="microphone-podcast-icon" width="128" height="128" class="alignright size-full wp-image-541" /></p>
<p>Hi,</p>
<p>I&#8217;ve been busy with things and so not too many updates lately. Not to worry thought, we have a brand new course and lots of free videos coming out soon on advanced MySQL.</p>
<p>In the following podcast (it was a video but I changed my mind &#8230;), I talk about the pragmatism of the Zend Framework dudes.</p>
<p>MP3: <a href='http://www.killerphp.com/articles/wp-content/uploads/2010/01/zendframework-and-doctrine.mp3'>zendframework-and-doctrine</a></p>
<p>Short and sweet.</p>
<p>Stefan Mischook<br />
www.killerphp.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/two-thumbs-up-for-the-zend-framework-nerds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.killerphp.com/articles/wp-content/uploads/2010/01/zendframework-and-doctrine.mp3" length="3793983" type="audio/mpeg" />
		</item>
		<item>
		<title>Live Webinar on Google Wave and the Zend Framework</title>
		<link>http://www.killerphp.com/articles/live-webinar-on-google-wave-and-the-zend-framework/</link>
		<comments>http://www.killerphp.com/articles/live-webinar-on-google-wave-and-the-zend-framework/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 16:31:29 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Advanced PHP]]></category>
		<category><![CDATA[Object Oriented PHP]]></category>
		<category><![CDATA[PHP Videos]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/?p=362</guid>
		<description><![CDATA[Hi Guys,
My good buddy and right-hand-nerd, Jon is being flown down to do a live webinar for the Zend geeks at Intuit. It seems the accounting giant has recognized Jon&#8217;s ability to take the complex and make it seem simple.
Just in case you don&#8217;t know, Jon is the author of our crazy cool shopping cart [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Guys,</p>
<p>My good buddy and right-hand-nerd, Jon is being flown down to do a live webinar for the Zend geeks at Intuit. It seems the accounting giant has recognized Jon&#8217;s ability to take the complex and make it seem simple.</p>
<p>Just in case you don&#8217;t know, Jon is the author of our crazy cool <a href="http://www.killerphp.com/tutorials/shopping-cart-tutorial/">shopping cart tutorial</a> and our new series on <a href="http://www.killerphp.com/tutorials/advanced-php/">advanced PHP</a>. </p>
<p>&#8230; Jon is starting to realize that my choice to go with the Zend Framework a few years ago made sense. Actually, it made dollars and cents!</p>
<p> <img src='http://www.killerphp.com/articles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>OK, bad nerd humor &#8230; I know. I&#8217;m just low on material that isn&#8217;t profanity laced.</p>
<p>If you want to know WHY, after looking at all the other PHP frameworks out there, that I thought the Zend Framework was the best choice long term (even back when Zend was still in Beta) .. you&#8217;re going to have to ask! </p>
<p>Anyway here is the official announcement:</p>
<blockquote><p>Jon Lebensold, author of the popular <a href="http://www.killerphp.com/tutorials/shopping-cart-tutorial/">PHP Shopping Cart</a> and founder of <a href="http://www.zendcasts.com">Zendcasts.com</a> will be writing a Google Wave Gadget in Boston at Intuit&#8217;s East coast office. Intuit is setting up a live webinar which you can attend by <a href="http://zendcasts.com/googlewave-quickbase-zend/">registering on the Zendcasts website</a>.</p>
<p>Zendcasts.com began this year with the hope of assisting intermediate PHP developers further their Zend Framework skills. If you&#8217;re a PHP developer interested in building apps on Google Wave or want to watch someone build an AJAX application with web services like Google Wave and Intuit&#8217;s QuickBase, this free webinar will be worth spending a lunch hour at your desk.</p>
<p>The webinar takes place <strong>Wednesday, November 18 at 12:00 (noon) Eastern Standard Time (GMT -05:00)</strong>.<a href="http://zendcasts.com/googlewave-quickbase-zend/">Register online now</a>.</p></blockquote>
<p>Here&#8217;s the banner:</p>
<p><img src="http://www.killerphp.com/articles/wp-content/uploads/2009/11/qb-gwave-promo.jpg" alt="qb-gwave-promo" title="qb-gwave-promo" width="300" height="240" /></p>
<p>Just in case you are not familiar with <a href="http://quickbase.intuit.com">Quickbase</a> &#8230; just click on the link.</p>
<p>That&#8217;s it for today. But coming soon, I will have some pretty big news &#8230; actually, the biggest thing to come to killerphp.com since we ordered that huge pizza! Ok, even bigger than that!!</p>
<p> <img src='http://www.killerphp.com/articles/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Stefan Mischook<br />
www.killerphp.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/live-webinar-on-google-wave-and-the-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Video: Why Zend instead of other PHP Frameworks?</title>
		<link>http://www.killerphp.com/articles/php-video-why-zend-instead-of-other-php-framework/</link>
		<comments>http://www.killerphp.com/articles/php-video-why-zend-instead-of-other-php-framework/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 02:21:40 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Advanced PHP]]></category>
		<category><![CDATA[PHP Videos]]></category>
		<category><![CDATA[Zend-Framework]]></category>
		<category><![CDATA[php podcast]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/?p=170</guid>
		<description><![CDATA[
Hi,
In response to my a recent podcast where I recommended that PHP programmers learn the Zend Framework,  I was asked why I choose Zend, rather than other PHP frameworks. 
The video:


Some notes:
Just in case you can&#8217;t stand listening me bather about this in my videocast, here are the bullet points:

Choose an MVC framework.
Choose a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.killerphp.com/articles/wp-content/uploads/2008/09/video-wheel.png" alt="php video " title="video-wheel" width="65" height="65" class="alignright size-full wp-image-154" /></p>
<p>Hi,</p>
<p>In response to my a recent podcast where I recommended that <a href="http://www.killerphp.com/articles/php-video-the-zend-framework-and-web-20/">PHP programmers learn the Zend Framework</a>,  I was asked why I choose Zend, rather than other PHP frameworks. </p>
<p><strong>The video:</strong></p>
<p><span id="more-170"></span></p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/A1dmxvN6vRs&#038;hl=en&#038;fs=1&#038;rel=0&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/A1dmxvN6vRs&#038;hl=en&#038;fs=1&#038;rel=0&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Some notes:</p>
<p>Just in case you can&#8217;t stand listening me bather about this in my videocast, here are the bullet points:</p>
<ul>
<li>Choose an MVC framework.</li>
<li>Choose a framework that is flexible.</li>
<li>Choose a framework that has a strong community backing it.</li>
</ul>
<p>The details to the above points are of course found in the videocast.</p>
<p><strong>HD videos are still a work in progress:</strong></p>
<p>I know the new video presentations need some polish &#8211; they are a work in progress. So I appreciate your patience with me as I work out my kinks. </p>
<p>Anyway, I hope you find them useful.</p>
<p>Stefan Mischook</p>
<p>www.killerphp.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/php-video-why-zend-instead-of-other-php-framework/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting up an MVC structure with the Zend Framework &#8211; part 2</title>
		<link>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-2/</link>
		<comments>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-2/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 17:53:28 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[PHP Videos]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-2/</guid>
		<description><![CDATA[Hi,
I&#8217;ve released our second video (part 2 of 2) on setting up an  MVC structure with the Zend Framework. 

This Zend Framework video is from our resident Zend-nerd: Jon Lebensold.
Again, let us know what you think and should you have any suggestions or request, please feel free to comment.
Running time: 19+ minutes
Part 2 of [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve released our second video (part 2 of 2) on setting up an  <a href="http://www.killerphp.com/zend-framework/videos/mvc-zend-part-2.php">MVC structure with the Zend Framework</a>. </p>
<p><a href="http://www.killerphp.com/zend-framework/videos/mvc-zend-part-1.php"><img id="image100" src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" alt="zend framework logo" /></a></p>
<p>This Zend Framework video is from our resident Zend-nerd: <a href="http://jon.lebensold.ca/">Jon Lebensold</a>.</p>
<p>Again, let us know what you think and should you have any suggestions or request, please feel free to comment.</p>
<p>Running time: 19+ minutes<br />
Part 2 of 2</p>
<p>Thanks,</p>
<p>Stefan Mischook</p>
<p>www.killerphp.com<br />
www.killersites.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Setting up an MVC structure with the Zend Framework &#8211; part 1</title>
		<link>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-1/</link>
		<comments>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-1/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 19:21:12 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Object Oriented PHP]]></category>
		<category><![CDATA[PHP Videos]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-1/</guid>
		<description><![CDATA[Hi,
I just released a new video on setting up an MVC structure with the Zend Framework. This video is a little more basic than the previous Zend videos &#8230; I had to twist Jon&#8217;s arm a little.

Anyway, let us know what you think and should you have any suggestions or request, please feel free to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I just released a new video on setting up an <a href="http://www.killerphp.com/zend-framework/videos/mvc-zend-part-1.php">MVC structure with the Zend Framework</a>. This video is a little more basic than the previous Zend videos &#8230; I had to twist <a href="http://jon.lebensold.ca/">Jon&#8217;s</a> arm a little.</p>
<p><a href="http://www.killerphp.com/zend-framework/videos/mvc-zend-part-1.php"><img id="image100" src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" alt="zend framework logo" /></a></p>
<p>Anyway, let us know what you think and should you have any suggestions or request, please feel free to comment.</p>
<p>Running time: 12+ minutes<br />
Part 1 of 2.</p>
<p>Thanks,</p>
<p>Stefan Mischook</p>
<p>www.killerphp.com<br />
www.killersites.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/setting-up-an-mvc-structure-with-the-zend-framework-part-1/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>PEAR vs. Zend Framework</title>
		<link>http://www.killerphp.com/articles/pear-vs-zend-framework/</link>
		<comments>http://www.killerphp.com/articles/pear-vs-zend-framework/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 04:20:05 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Advanced PHP]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/pear-vs-zend-framework/</guid>
		<description><![CDATA[PEAR vs. Zend Framework
Now that the Zend Framework is ready for &#8216;prime time&#8217;, I&#8217;ve been considering the Pear framework with regards to how it now fits in the PHP world.

NOTE:
Several picky nerds have pointed out that PEAR is not a framework &#8211; check out the comments below. OK, I would agree, technically speaking, PEAR is [...]]]></description>
			<content:encoded><![CDATA[<p>PEAR vs. Zend Framework</p>
<p>Now that the Zend Framework is ready for &#8216;prime time&#8217;, I&#8217;ve been considering the <a href="http://pear.php.net/">Pear framework</a> with regards to how it now fits in the PHP world.</p>
<p><img id="image100" src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" alt="zend framework logo"  /></p>
<p>NOTE:</p>
<p>Several picky nerds have pointed out that PEAR is not a framework &#8211; check out the comments below. OK, I would agree, technically speaking, PEAR is not a framework. That said, this is what the PEAR people say on the home page of their web site:</p>
<blockquote><p>‘PEAR is a framework and distribution system for reusable PHP components. You can find help using PEAR packages in the online manual and the FAQ.’</p></blockquote>
<p>Anyway, that is an argument of semantics and nerd-details &#8230; not the point of my article.</p>
<p>&#8230; Back to my article:</p>
<p><strong><br />
Both Zend and Pear are frameworks but how are they different?</strong></p>
<p>I would say that the Zend Framework attempts to create a comprehensive whole &#8211; a consistent set of components that are designed to work together in a unified manner. </p>
<p>&#8230; That is one of the reasons for a framework in the first place.</p>
<p>Though unified,  one of the cool things about the Zend Framework is that you can just pick and choose what components you want to use &#8211; you don&#8217;t have to buy the whole cake to take advantage of all that juicy object oriented PHP code.</p>
<p><strong>About PEAR:</strong><br />
<img id="image130" src="http://www.killerphp.com/articles/wp-content/uploads/2008/03/pear-logo.png" alt="pear-framework-logo" style="float: right; margin: 15px;" /></p>
<p>With the Pear framework, it is more of a hodgepodge/motley of assorted components. Pear is widely used (and useful) but it does cross over (in terms of functionality) with what we have in the Zend Framework. So the question that comes to my mind is:</p>
<p><strong>Do we still use Pear, if we have the Zend Framework?</strong></p>
<p><span id="more-117"></span></p>
<p>The simple answer is found in the version of PHP you are using:</p>
<p>If you are using PHP 4, you will have to use PEAR since the Zend Framework depends on PHP 5.  Remember that PEAR does predate the Zend Framework.</p>
<p>And on the flip side, if you are using PHP 5, you might as well favor the Zend Framework since it is a comprehensive unified framework. </p>
<p>-</p>
<p>While considering this question (PEAR vs. ZEND Framework) I struck up a conversation with Jonathan about this &#8230; I thought it was worth including here:</p>
<blockquote><p>Hi,</p>
<p>I was wondering what you thought about Pear given that Zend is out?</p>
<p>&#8230; Is there cross over or does Zend leverage Pear? </p>
<p>Thanks,</p>
<p>Stefan</p>
<p>Jonathan Lebensold wrote:</p>
<p>From what I&#8217;ve seen there&#8217;s no dependency with Pear in Zend. Although Zend appears to be a higher-level functional replacement for Pear. (Pear kinda sat between what you would expect php to provide you in extensions and what would facilitate a developer in writing applications. That distinction is now made through extensions / PECL (C libraries) and Zend)</p>
<p>J.</p>
<p>From what I can see, if you are using PHP5, Pear is no longer needed because of Zend &#8211; would you agree?</p>
<p>Stefan </p>
<p>Jonathan Lebensold wrote:</p>
<p>I think that pear will be deprecated since it was unreliably deployed on webhosts (which led people to dumping instances of the whole PEAR framework into their applications.. mind you that&#8217;s what people are doing with ZEND).</p>
<p>I would say that PEAR is on the downward slope, but a lot of legacy code depended on it (especially from PHP4 era). newer applications should look towards independent classes (like the ones at phpclasses.org) or solutions provided in frameworks (like smarty / zend / cake / etc&#8230;)</p>
<p>j
</p></blockquote>
<p><strong><br />
Conclusion:</strong></p>
<p>We&#8217;ve developed a couple of Web 2.0 applications with beta versions of the Zend Framework and I think we made a good choice:</p>
<p>&#8230; Even with that early version of the framework, we found it to be very useful and worth implementing. </p>
<p>Another bright spot, was that we got new developers productive with the Zend Framework rather quickly. A nice change from what I had to deal with during my Java days! Did I say Web Objects sucks?</p>
<p> <img src='http://www.killerphp.com/articles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyway, I&#8217;m excited to explore the latest releases of the Zend Framework and to write more about it as time permits.</p>
<p>Thanks for reading,</p>
<p>Stefan Mischook</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/pear-vs-zend-framework/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Zend Framework Video Tutorials</title>
		<link>http://www.killerphp.com/articles/zend-framework-video-tutorials/</link>
		<comments>http://www.killerphp.com/articles/zend-framework-video-tutorials/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 03:09:07 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[PHP Videos]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/zend-framework-video-tutorials/</guid>
		<description><![CDATA[
I just launched a new section on Killerphp.com on the Zend Framework.
I figured it only made sense, given that we&#8217;ve built two live web applications based on it:
Video sharing site: www.idea22.com
Web template sharing site: www.webshapes.org
-
For those of you who are not familar with the Zend Framework:
The Zend Framework is a web application framework designed to [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image100" src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" alt="zend framework logo" style="float: right; margin: 15px;" /></p>
<p>I just launched a new section on Killerphp.com on the <a href="http://www.killerphp.com/zend-framework/">Zend Framework</a>.</p>
<p>I figured it only made sense, given that we&#8217;ve built two live web applications based on it:</p>
<p>Video sharing site: <a href="http://www.idea22.com">www.idea22.com</a><br />
Web template sharing site: <a href="http://www.webshapes.org">www.webshapes.org</a></p>
<p>-</p>
<p>For those of you who are not familar with the Zend Framework:</p>
<p>The Zend Framework is a web application framework designed to make building complex PHP based web applications easier.</p>
<p>The Zend Framework contains a series of components (built using PHP 5) that manages many common task in web application development:</p>
<p>    * Zend_Form: to make form handling/processing easier.<br />
    * Zend_Mail: makes email functionality trivial to create in PHP.<br />
    * Zend_Db_Adapter: to connect to databases.<br />
    * Zend_Pdf: allows you to easily create and edit PDF documents.</p>
<p>&#8230; And this is just a small sampling.</p>
<p>-</p>
<p>There is a lot more in the works in terms of our videos and articles.</p>
<p>Thanks,</p>
<p>Stefan Mischook</p>
<p>www.killerphp.com<br />
www.killersites.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/zend-framework-video-tutorials/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Zend Framework: Using View Helpers to Build Rich, Scalable, Controls</title>
		<link>http://www.killerphp.com/articles/zend-framework-view-helpers/</link>
		<comments>http://www.killerphp.com/articles/zend-framework-view-helpers/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 21:31:50 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Advanced PHP]]></category>
		<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/zend-framework-view-helpers/</guid>
		<description><![CDATA[Using View Helpers to Build Rich, Scalable, Controls
by: Jon Lebensold
Whether you&#8217;re developing an ASP.NET application, working with rails or dealing with a templating engine like Smarty, the idea of partial templates is not foreign. Partial templates allow developers and designers to work with panels or sub-groupings of content that need to be dynamic. 
With a [...]]]></description>
			<content:encoded><![CDATA[<p>Using View Helpers to Build Rich, Scalable, Controls<br />
by: <a href="http://jon.lebensold.ca">Jon Lebensold</a></p>
<p>Whether you&#8217;re developing an ASP.NET application, working with rails or dealing with a templating engine like Smarty, the idea of partial templates is not foreign. Partial templates allow developers and designers to work with panels or sub-groupings of content that need to be dynamic. </p>
<p>With a proper AJAX framework in place, these controls can be written in a way that they can be updated in whichever Controller they eventually reside. This kind of flexibility can allow you the flexibility of using certain signature controls for multiple parts of an application. </p>
<p><span id="more-108"></span></p>
<p>For example, you could develop an AJAX comment box that would write comments for articles and blog posts but would hit different database tables based on it&#8217;s constructer. The rest of the control would remain the same, resulting in a more consistent look and feel for your users. </p>
<p>View Helpers are not partials in the Ruby on Rails sense since they&#8217;re is view logic associated with them and they don&#8217;t explicitly have .phtml files. View Helpers also aren&#8217;t like wordpress templates, with content broken up into different parts (a good example of this kind of compositional design will be coming in the Zend_Layout package to be released soon). </p>
<p>View Helpers seem to resemble the user control concept of in .NET, where a panel can be dropped into any form, with its codebehind managing any events or user-control specific display code. </p>
<p>In summary, View Helpers are great for encapsulating forms, grids and other functionality that could eventually be bound to a different data source or even be pushed back to the user through a simple AJAX call. </p>
<p>According to the samples provided in the Zend documentation, View Helpers seem to mix presentation with logic. My assumption is this was intended to limit the creation of Zend_View objects since Zend_View can load View Helpers dynamically.</p>
<p>The View Helper sample provided in the zend documentation looks like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> My_View_Helper_SpecialPurpose</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; protected <span class="re0">$_count</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">function</span> specialPurpose<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$this</span>-&gt;_count++;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$output</span> = <span class="st0">&quot;I have seen &#8216;The Jerk&#8217; {$this-&gt;_count} time(s).&quot;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/htmlspecialchars"><span class="kw3">htmlspecialchars</span></a><span class="br0">&#40;</span><span class="re0">$output</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>While this works for simple output, where a View Helper would be interacting with the calling object (which is typically the Zend_View), this approach doesn&#8217;t lend itself to doing rich partial templating.</p>
<p>As long as you keep the Helpers in one phtml file, you could add a &#8220;helpers&#8221; folder to your document tree and render the View Helper like any other  view. The advantage of this is that factoring out part of your template into an AJAX control becomes really trivial. Furthermore, your display and view logic are separated, and lastly, you could even test the View Helper (including its behaviour) without a particular controller action in mind.</p>
<p>These javascript samples could be written more elegantly by loading the javascript through a referenced javascript file file that is tailored to a particular part of an application.</p>
<p><b>The actual index.phtml page could look something like this: </b></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">// this is generic enough that it could be pushed into an external .js file
</div>
</li>
<li class="li1">
<div class="de1">function loadMyPost(id)
</div>
</li>
<li class="li2">
<div class="de2">{
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">if ($(id+&#8217;_MyPostForm&#8217;).title.value.length &gt; 0)
</div>
</li>
<li class="li1">
<div class="de1">var params = &#8216;title=&#8217;+$(id+&#8217;_MyPostForm&#8217;).title.value;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">new Ajax.Request(&#8217;/ajax/MyPost&#8217;, {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; method: &#8216;post&#8217;,
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; parameters: params,
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; onSuccess: function(transport, json) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; //use and handle foo response data
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; $(id+&#8217;_MyPostForm&#8217;).insert(transport.responseText);
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; },
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; on500: function(transport) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; //handle error, inform user
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; alert(&#8217;error&#8217;);
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">});
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li2">
<div class="de2">&lt;/script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;?= $this-&gt;MyPost(&quot;&quot;); &nbsp;?&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;?= $this-&gt;MyPost(&quot;&quot;); &nbsp;?&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Notice how I&#8217;ve called MyPost twice? each one of these view helpers will have its own javascript configuration and will fire independently of it&#8217;s predecessor, thanks to View Helpers being able to call their inheritor to see how many times they&#8217;ve been invoked on a page. </p>
<p><b>The actual helpers/MyPost.phtml page would then look like this: </b></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">function ajaxLoad_&lt;?=$this-&gt;formId ?&gt;(event)
</div>
</li>
<li class="li1">
<div class="de1">{
</div>
</li>
<li class="li2">
<div class="de2">loadMyPost(&lt;?=$this-&gt;formId ?&gt;);
</div>
</li>
<li class="li1">
<div class="de1">return false;
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&lt;/script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&lt;div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;form id=&quot;&lt;?php echo $this-&gt;formId; ?&gt;_MyPostForm&quot;
</div>
</li>
<li class="li1">
<div class="de1">action=&quot;/index&quot;
</div>
</li>
<li class="li1">
<div class="de1">method=&quot;post&quot;
</div>
</li>
<li class="li1">
<div class="de1">onsubmit=&quot;return ajaxLoad_&lt;?=$this-&gt;formId; ?&gt;(this);&quot; &gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;?= $this-&gt;formText(&#8217;title&#8217;, $this-&gt;title, array(&#8217;size&#8217; =&gt; 32) ); ?&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;?= $this-&gt;formSubmit(&#8217;POST!&#8217;, &quot;&quot; ); ?&gt;
</div>
</li>
<li class="li2">
<div class="de2">&lt;?= $this-&gt;title; &nbsp;?&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/form&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Notice that the View Helper itself is using another View Helper (formSubmit) to simplify the submit button on the actual form. We could easily extend this example with lookups that would dictate the visibility of certain portions of the View Helper. This way, the View Helper is responsible for rendering logic and it can be given a set of data to render the View by, or rather, it can &#8220;call out&#8221; in the actual Zend_View_Helper_MyPost class.</p>
<p><b>MyPost.php (the code-behind for the View Helper):</b></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> Zend_View_Helper_MyPost <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; protected <span class="re0">$_formId</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">function</span> MyPost<span class="br0">&#40;</span><span class="re0">$title</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$view</span> = <span class="kw2">new</span> Zend_View<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$view</span>-&gt;<span class="me1">setBasePath</span><span class="br0">&#40;</span>BASEPATH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$view</span>-&gt;<span class="me1">formId</span> = ++<span class="re0">$this</span>-&gt;<span class="me1">formId</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$view</span>-&gt;<span class="me1">title</span> = <span class="re0">$title</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="re0">$view</span>-&gt;<span class="me1">render</span><span class="br0">&#40;</span><span class="st0">&quot;helpers/MyPost.phtml&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>This is an example of a form that could be dynamically posted from any page in your application.</p>
<p>Notice how the javascript uses the &#8220;formId&#8221; (which could be derived through using the same method as $this_count++ in the previous example) to maintain uniqueness. This enables the creation of multiple instances of the View Helper on the page, all bound to their own javascript event listeners or custom javascript.</p>
<p> Using prototype, you can submit directly to that particular version of the ajaxMethod or even post the View Helpers&#8217; form to a Controller that supports Ajax Postbacks. Luckily, proposals like <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Controller_Action_Helper_AjaxContext">Zend_Controller_Action_Helper_AjaxContext</a> intend to facilitate this process of managing how a view is rendered from a controller. In this particular example, I&#8217;ve created a custom AjaxController for my application that looks like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> MyPostAction<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* [Xml response] */</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$responseDataXmlEncoded</span> = <span class="st0">&#8216;&lt;div&gt;&#8217;</span> . <span class="re0">$this</span>-&gt;_request-&gt;<span class="me1">getParam</span><span class="br0">&#40;</span><span class="st0">&#8216;title&#8217;</span><span class="br0">&#41;</span> . <span class="st0">&#8216;&lt;/div&gt;&#8217;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$this</span>-&gt;<span class="me1">getResponse</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">setHeader</span><span class="br0">&#40;</span><span class="st0">&#8216;Content-Type&#8217;</span>, <span class="st0">&#8216;text/xml&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&gt;<span class="me1">setBody</span><span class="br0">&#40;</span><span class="re0">$responseDataXmlEncoded</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>The custom View Helper will post to MyPostAction where the standard Zend_Controller methods can be used to collect the postback and return an XML result. This way, you can easily migrate existing postback code into an AJAX-enabled view-helper. MyPostAction has been configured to return xml instead of a regular phtml template. In order for this to work, you need to disable default rendering in the init() function of the AjaxController:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> init<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$this</span>-&gt;_helper-&gt;<span class="me1">viewRenderer</span>-&gt;<span class="me1">setNoRender</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>The same technique can be applied to a JSON formatted response, where prototype (or any other javascript framework one of your choice) could be used to pick up the response and create a javascript &#8220;object&#8221; that&#8217;s ready for rendering.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/zend-framework-view-helpers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Zend Framework Components Part 2: Zend_View</title>
		<link>http://www.killerphp.com/articles/zend-framework-components-part-2-zend_view/</link>
		<comments>http://www.killerphp.com/articles/zend-framework-components-part-2-zend_view/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 03:13:14 +0000</pubDate>
		<dc:creator>Stefan Mischook</dc:creator>
				<category><![CDATA[Zend-Framework]]></category>

		<guid isPermaLink="false">http://www.killerphp.com/articles/zend-framework-components-part-2-zend_view/</guid>
		<description><![CDATA[By: Jon Lebensold

As part of a series of articles about the Zend Framework and MVC, I&#8217;d like to take some time and cover Zend_View (the &#8216;V&#8217; in that MVC triad).
Within the Zend Framework architecture and documentation, Zend_View is often coupled with the Zend_Controller as a means of providing a templating engine that encourages smart defaults [...]]]></description>
			<content:encoded><![CDATA[<p>By: Jon Lebensold</p>
<p><img id="image100" alt="zend framework logo" style="margin: 10px; float: right" src="http://www.killerphp.com/articles/wp-content/uploads/2007/11/picture-1.png" /></p>
<p>As part of a series of articles about the Zend Framework and MVC, I&#8217;d like to take some time and cover Zend_View (the &#8216;V&#8217; in that MVC triad).</p>
<p>Within the Zend Framework architecture and documentation, Zend_View is often coupled with the Zend_Controller as a means of providing a templating engine that encourages smart defaults over explicit programming.</p>
<p>For example, if I have a Controller named &#8216;AccountsController&#8217; with an action (AKA a method that ends in &#8216;Action&#8217; inside the AccountsController) called &#8220;new&#8221;, this would be mapped to the url &#8220;mydomain.com/Accounts/new&#8221;.</p>
<p>After running whatever is found inside AccountsConroller::newAction(), the Zend_Controller would be clever enough to dig out of my application/views/scripts folder, the Accounts/new.phtml file as a template for the action in question.</p>
<p><span id="more-106"></span></p>
<p>This sounds great at first, however you&#8217;ll find yourself adding:</p>
<p>< ? php include 'scripts/header.php'; ?></p>
<p>&#8230; to the top and:</p>
<p>< ? php include 'scripts/footer.php'; ?></p>
<p>&#8230; to the bottom of every phtml file! This breaks the DRY principle (Don&#8217;t Repeat Yourself!) which leads us to&#8230;</p>
<p><strong>Creating a Standard Layout for all Zend_Views Loaded by Zend_Controller</strong></p>
<p>The default behaviour of Zend_Controller is actually handled by the Zend_Controller_Front class, which then routes and loads the appropriate Controller in your application. In order to inject a custom template, we need to do three things:</p>
<p>1- Write a Layout Plugin<br />
2- Create our beautiful layout<br />
3- Register the plugin</p>
<p>The LayoutPlugin is a piece of cake, especially since I&#8217;ve written a class that can be implemented in any project:</p>
<p>/*<br />
*  Handles the header / footer by capturing the preDispatch and postDispatch of the<br />
*  response object<br />
*<br />
*/<br />
class LayoutPlugin extends Zend_Controller_Plugin_Abstract<br />
{<br />
private $view;<br />
function __construct()<br />
{<br />
$this->view = new Zend_View();<br />
$this->view->setScriptPath(&#8217;../application/views/scripts&#8217;);<br />
}</p>
<p>/*<br />
*  Run at the beginning of the controller&#8217;s response object initialization<br />
*/<br />
public function preDispatch( Zend_Controller_Request_Abstract $request )<br />
{<br />
$this->getResponse()->prepend(&#8217;header&#8217;,$this->view->render(&#8217;header.phtml&#8217;,null,true));<br />
}<br />
/*<br />
*  Run at the end of the controller&#8217;s response object initialization<br />
*/<br />
public function postDispatch( Zend_Controller_Request_Abstract $request )<br />
{<br />
$this->getResponse()->append(&#8217;footer&#8217;, $this->view->render(&#8217;footer.phtml&#8217;,null,true));<br />
}</p>
<p>}</p>
<p>The interesting parts of this class are setScriptPath() , prepend() and append(). Essentially, the Zend Plugin architecture is expecting preDispatch and postDispatch to be available in any plugin that&#8217;s injected into the Front_Controller.</p>
<p>What we&#8217;re basically doing is telling Zend_Front_Controller to prepend &#8216;header.phtml&#8217; and append &#8216;footer.phtml&#8217; to all of our pages. We could get fancier by pulling a variable from our registry that would affect which header and footer is loaded (see my previous blog post for a sample of how to use Zend_Registry).</p>
<p><strong>Step 2</strong> is adding &#8216;header.phtml&#8217; and &#8216;footer.phtml&#8217; to your application/views/scripts/ folder with their respective headers and footers. Personally, I like to start my websites either with an open source template from <a href="http://blog.html.it/layoutgala/">LayoutGala</a> or <a href="http://www.webshapes.org">Webshapes</a> so that I have a good structural starting point for my application.</p>
<p><strong>Step 3</strong> is simply registering the component. In your index.php, assuming you&#8217;ve setup Zend_Loader to register classes automatically, one line of code needs to be added after Zend_Front_Controller is declared:</p>
<p>$controller = Zend_Controller_Front::getInstance();<br />
// add the following to register our newly-created layout plugin.<br />
$controller->registerPlugin(new LayoutPlugin());<br />
$controller->dispatch();</p>
<p>In my next post, I&#8217;ll cover using Zend_View without Zend_Controller. This will lead up to creating custom View Helpers that can then be loaded dynamically through your PHP AJAX framework of choice!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerphp.com/articles/zend-framework-components-part-2-zend_view/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
