<?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>Bradley Holt &#187; Zend Framework</title>
	<atom:link href="http://bradley-holt.com/tag/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://bradley-holt.com</link>
	<description></description>
	<lastBuildDate>Mon, 23 Aug 2010 13:23:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zend Framework 2.0 and PHP 5.3 Web Applications SXSW Interactive Panel</title>
		<link>http://bradley-holt.com/2010/08/zend-framework-2-0-and-php-5-3-web-applications-sxsw-interactive-panel/</link>
		<comments>http://bradley-holt.com/2010/08/zend-framework-2-0-and-php-5-3-web-applications-sxsw-interactive-panel/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 17:01:13 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SXSW]]></category>
		<category><![CDATA[SXSWi]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=751</guid>
		<description><![CDATA[I have submitted a panel on Zend Framework 2.0 and PHP 5.3 Web Applications for the 2011 SXSW Interactive Festival. Please consider giving this panel your vote. From the panel&#8217;s description:
Zend Framework is a free/open source web application framework. It can  be used either as a component library or as a full-stack  Model–View–Controller [...]]]></description>
			<content:encoded><![CDATA[<p>I have submitted a panel on <a href="http://panelpicker.sxsw.com/ideas/view/6336">Zend Framework 2.0 and PHP 5.3 Web Applications</a> for the 2011 <a href="http://sxsw.com/interactive">SXSW Interactive Festival</a>. Please consider giving this panel your vote. From the panel&#8217;s description:</p>
<blockquote><p>Zend Framework is a free/open source web application framework. It can  be used either as a component library or as a full-stack  Model–View–Controller (MVC) framework. As compared to its 1.x  counterparts, Zend Framework 2.0 is easier to learn, trivially simple to  extend, and more performant. It is also easier to use just specific  parts of the framework as needed. We will explore the many features of  Zend Framework 2.0 including its tooling, functional testing, form,  database, pagination, date, markup, navigation, and MVC components.   Zend Framework 2.0 takes advantages of several new features in PHP 5.3  including closures/lambdas, namespaces, and late static binding. We will  explore some of these new features to understand why PHP 5.3 is a  requirement for Zend Framework 2.0 and how you can leverage these new  features within your application itself. An example web application will  be provided that you can use as a reference when building your own Zend  Framework web application.</p></blockquote>
<p>For those wondering, Zend Framework 2.0 is not out yet but SXSW is not until next March and Zend Framework 2.0 will most likely be released by then. The description above is based on the <a href="http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Requirements">Zend Framework 2.0 Requirements</a> and discussions on the Zend Framework contributors mailing list.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/08/zend-framework-2-0-and-php-5-3-web-applications-sxsw-interactive-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Roundtable</title>
		<link>http://bradley-holt.com/2010/05/magento-roundtable/</link>
		<comments>http://bradley-holt.com/2010/05/magento-roundtable/#comments</comments>
		<pubDate>Thu, 27 May 2010 15:20:27 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BTV]]></category>
		<category><![CDATA[btvphpug]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Vermont]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=691</guid>
		<description><![CDATA[Next week&#8217;s Burlington, VT PHP Users Group meeting will be a Magento Roundtable discussion. From the meeting description:
Over the last year, Magento has  increased in popularity as a viable open source eCommerce platform for  the mid to large scale online retailer. This rapid growth has lead to  many questions on what has been [...]]]></description>
			<content:encoded><![CDATA[<p>Next week&#8217;s <a href="http://groups.google.com/group/burlington-vt-php">Burlington, VT PHP Users Group</a> meeting will be a <a href="http://btvphpug-2010-06-03.eventbrite.com/">Magento Roundtable</a> discussion. From the meeting description:</p>
<blockquote><p>Over the last year, <a href="http://www.magentocommerce.com/" target="_blank">Magento</a> has  increased in popularity as a viable open source eCommerce platform for  the mid to large scale online retailer. This rapid growth has lead to  many questions on what has been fixed, what continues to be a problem,  and how complex a system an eCommerce engine needs to be.</p>
<p>Have you used Magento? Are you considering using it for an upcoming  project? Do you have a specific problem that Magento solves for you and  would like to share your story? Join the roundtable and compare notes  with others who have experience with Magento.</p>
<p>Meetings are open to  the public via RSVP. You will have the chance to network and connect  with fellow PHP developers.</p>
<p>To Participate:</p>
<ol>
<li>Register on Eventbrite.</li>
<li>Sign up for the <a href="http://groups.google.com/group/burlington-vt-php">Burlington, VT  PHP User Group</a> list on Google Groups.</li>
<li>Forward this <a href="http://btvphpug-2010-06-03.eventbrite.com/">link</a> to anyone else you feel would be interested in this meeting&#8217;s topics.</li>
</ol>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/05/magento-roundtable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TEK·X Day Two</title>
		<link>http://bradley-holt.com/2010/05/tek%c2%b7x-day-two/</link>
		<comments>http://bradley-holt.com/2010/05/tek%c2%b7x-day-two/#comments</comments>
		<pubDate>Fri, 21 May 2010 04:50:26 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Software Deployment]]></category>
		<category><![CDATA[SPL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[tekX]]></category>
		<category><![CDATA[tekX10]]></category>
		<category><![CDATA[Xdebug]]></category>
		<category><![CDATA[XMPP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=683</guid>
		<description><![CDATA[It&#8217;s hard to believe tomorrow is the last day of TEK·X. Where did the time go? Today started with Matthew Schmidt&#8217;s 10 Developer Trends in 2010. He talked about agile development, browser standards, AJAX, security vulnerabilities, RIAs, touch interfaces, key/value stores, version control, cloud computing, and dynamic languages. While not a bad keynote, the topics [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s hard to believe tomorrow is the last day of <a href="http://tek.phparch.com/">TEK·X</a>. Where did the time go? Today started with Matthew Schmidt&#8217;s 10 Developer Trends in 2010. He talked about agile development, browser standards, AJAX, security vulnerabilities, RIAs, touch interfaces, key/value stores, version control, cloud computing, and dynamic languages. While not a bad keynote, the topics seemed fairly basic and obvious given the audience.</p>
<p>Next up for me was Derick Rethans&#8217; <a href="http://xdebug.org/">Xdebug</a> talk. Xdebug is an extremely useful tool for PHP developers. I&#8217;ve used its <a href="http://xdebug.org/docs/stack_trace">stack trace</a> feature as well as its <a href="http://www.phpunit.de/manual/3.4/en/code-coverage-analysis.html">code coverage analysis via PHPUnit</a>. I&#8217;ve also dabbled with its <a href="http://xdebug.org/docs/profiler">profiling</a> capabilities. The session introduced me to several other Xdebug features with which I&#8217;d like to experiment.</p>
<p>After that I had the pleasure of seeing Matthew Turland&#8217;s talk on <a href="http://matthewturland.com/2010/05/20/new-spl-features-in-php-5-3/">New SPL Features in PHP 5.3</a>. New SPL data structures in PHP 5.3 include stacks, queues, heaps, priority queues, and sets. Matthew provided test code that compared the performance and memory usage of each these new data structures to that of using PHP&#8217;s array functionality.</p>
<p>I skipped the first afternoon session to take part in the Hack Track which happened to coincide with Zend Framework&#8217;s <a href="http://devzone.zend.com/article/12150">May Bug Hunt Days</a>. I was granted commit access and directly committed my first bug fix, a small change to <a href="http://framework.zend.com/issues/browse/ZF-9845">make HTTP headers case-insensitive</a>.</p>
<p>Others stuck around to fix more bugs while I went to check out Bill Karwin&#8217;s <a href="http://www.slideshare.net/billkarwin/models-for-hierarchical-data">Models for Hierarchical Data with SQL and PHP</a>. Examples of hierarchical data include categories/subcategories, bill of materials, and threaded discussions. Bill talked about four main approaches to storing hierarchical data in SQL databases: adjacency list, path enumeration, nested sets, and usage of a closure table.</p>
<p>The <em>adjacency list</em> is a naive approach that almost everyone tries first. Basically, each entry knows its immediate parent. The problem with this approach is that querying deep trees can be very inefficient involving many joins. <em>Path enumeration</em> involves storing an enumerated chain of ancestors in each entry. This can be very efficient and take advantage of indexing. However, there is no referential integrity with this approach. The <em>nested set</em> approach seemed a bit complicated. I don&#8217;t feel I can explain it properly here, so you&#8217;ll have to check out Bill&#8217;s slides if you&#8217;re interested in how this works. The <em>closure table</em> approach made the most sense to me and didn&#8217;t seem overly complicated. Not only do you store each entry, but you also store every path including those from the parent node to each descendant, those from each ancestor to its child node, as well as a reflexive reference from the node to itself.</p>
<p>My final session of the day was Travis Swicegood&#8217;s Building Real-Time Applications with XMPP, the <a href="http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol">Extensible Messaging and Presence Protocol</a>. If you&#8217;ve use Google Talk then you&#8217;ve used XMPP. As a web developer, the request and response pattern in HTTP is ingrained into my thinking. However, XMPP is a very different creature in that it keeps a socket open during what can be a lengthy exchange of messages. While I don&#8217;t think HTTP is going away anytime soon, real-time applications involving potentially large numbers of publishers and subscribers (e.g. Twitter) are becoming more prevalent and XMPP is well suited for this environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/05/tek%c2%b7x-day-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Searching A Field With Digits In Zend Framework&#8217;s Lucene Component</title>
		<link>http://bradley-holt.com/2010/04/searching-a-field-with-digits-in-zend-frameworks-lucene-component/</link>
		<comments>http://bradley-holt.com/2010/04/searching-a-field-with-digits-in-zend-frameworks-lucene-component/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 21:42:34 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=662</guid>
		<description><![CDATA[Recently I ran into a bug in one of our applications using Zend_Search_Lucene where the same document was showing up multiple times in search results. Actually, many different documents were showing up more than once. I tracked it down to the routine that updated indexed documents. With Zend_Search_Lucene you can&#8217;t actually update indexed documents, but [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I ran into a bug in one of our applications using <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> where the same document was showing up multiple times in search results. Actually, many different documents were showing up more than once. I tracked it down to the routine that updated indexed documents. With Zend_Search_Lucene you can&#8217;t actually update indexed documents, but you can delete an indexed document and then insert a new, updated, document. In order to delete a document you first must search for it by a previously indexed field and then, once found, delete it using its internal document identifier. The problem seemed to be that documents were not being found and deleted when updated, thus duplicates of the same document were accumulating on each update.</p>
<p>The field I was indexing, and subsequently using to find and delete documents, was a 40 character SHA-1 hash. While trying to track down the bug in my application, I discovered that only documents having a SHA-1 hash beginning with a digit were getting duplicated (in other words, were <em>not</em> being found when I tried to delete them) and that documents having a SHA-1 beginning with a letter were not getting duplicated (in other words, <em>were</em> being found and deleted).</p>
<p>A Stack Overflow post on <a href="http://stackoverflow.com/questions/547180/searching-numbers-with-zend-search-lucene">searching numbers with Zend_Search_Lucene</a> had the information I needed to fix the bug. First, I changed the hash field from a text field to a keyword field which prevented it from being tokenized (this, of course, required me to delete the existing index and re-index every document). Second, when searching on the hash field I replaced the default Text analyzer with the TextNum analyzer. These two changes seemed to do the trick, as I haven&#8217;t seen any duplicate search results after having run several index updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/04/searching-a-field-with-digits-in-zend-frameworks-lucene-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Layouts in Zend Framework</title>
		<link>http://bradley-holt.com/2010/03/layouts-in-zend-framework/</link>
		<comments>http://bradley-holt.com/2010/03/layouts-in-zend-framework/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 18:49:19 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=634</guid>
		<description><![CDATA[In my previous post in this series we looked at Zend Framework’s routing and Model-View-Controller (MVC) components. In this post we&#8217;ll take slight detour and explore Zend_Layout, a component that lets you have a consistent template for the layout of pages throughout your website.
In the past you may have implemented consisted layouts in PHP using [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://bradley-holt.com/2010/02/mvc-in-zend-framework/">previous post</a> in this series we looked at Zend Framework’s routing and <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller</a> (MVC) components. In this post we&#8217;ll take slight detour and explore <a href="http://framework.zend.com/manual/en/zend.layout.html"><code>Zend_Layout</code></a>, a component that lets you have a consistent template for the layout of pages throughout your website.</p>
<p>In the past you may have implemented consisted layouts in PHP using &#8220;includes&#8221; but, as you&#8217;ll see, layouts are much easier to manage than &#8220;includes&#8221;. The primary improvement over &#8220;includes&#8221; is that you can change the entire layout of your website without editing every single PHP script. This is because the layout decides where the content gets placed instead of each PHP script including the needed partials (e.g. header and footer). This is accomplished through an implementation of the <a href="http://martinfowler.com/eaaCatalog/twoStepView.html">Two Step View</a> pattern.</p>
<p>If you&#8217;re using <a href="http://framework.zend.com/manual/en/zend.tool.html"><code>Zend_Tool</code></a> then you can enable layouts using the command <code>zf enable layout</code>. This will create a layout view script, <a href="http://github.com/bradley-holt/postr/blob/master/application/layouts/scripts/layout.phtml"><code>application/layouts/scripts/layout.phtml</code></a>, and add the following line to the <code>production</code> section of your <a href="http://github.com/bradley-holt/postr/blob/master/application/configs/application.ini"><code>application/configs/application.ini</code></a> file:</p>
<pre><code>resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"</code></pre>
<p><code>Zend_Layout</code> has a <a href="http://framework.zend.com/manual/en/zend.controller.plugins.html">front controller plugin</a> that has two main jobs. First, it takes care of rendering the layout for us. Second, it retrieves what are called &#8220;named segments&#8221; from Zend Framework&#8217;s response object and assigns them as variables in your layout. A segment named &#8220;default&#8221; is assigned to the variable named <code>content</code>. Typically (unless you do something to override this) the &#8220;default&#8221; segment will contain the output of your individual controller actions. This means that you can render the content of your controller actions wherever you&#8217;d like in your layout view script by outputting the value of <code>$this-&gt;layout()-&gt;content</code>.</p>
<p>In the demo blogging application, <a href="http://github.com/bradley-holt/postr">Postr</a>, I&#8217;ve also created a header layout view script, <a href="http://github.com/bradley-holt/postr/blob/master/application/layouts/scripts/header.phtml"><code>application/layouts/scripts/header.phtml</code></a>, and a footer layout view script, <a href="http://github.com/bradley-holt/postr/blob/master/application/layouts/scripts/footer.phtml"><code>application/layouts/scripts/footer.phtml</code></a>. The header and footer layout view scripts are rendered by outputting the results of <code>$this-&gt;render('header.phtml')</code> and <code>$this-&gt;render('footer.phtml')</code>, respectively.</p>
<p>In my next post in this series I plan on taking a look at the <code>Entry</code> controller (<a href="http://github.com/bradley-holt/postr/blob/master/application/controllers/EntryController.php"><code>application/controllers/EntryController.php</code></a>) in the demo blogging application, <a href="http://github.com/bradley-holt/postr">Postr</a>. We&#8217;ll explore its actions and corresponding view scripts. <a href="http://framework.zend.com/manual/en/zend.form.html"><code>Zend_Form</code></a>, <a href="http://framework.zend.com/manual/en/zend.paginator.html"><code>Zend_Paginator</code></a>, and modeling domain objects will be touched on briefly, but explored in more depth in later posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/03/layouts-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC in Zend Framework</title>
		<link>http://bradley-holt.com/2010/02/mvc-in-zend-framework/</link>
		<comments>http://bradley-holt.com/2010/02/mvc-in-zend-framework/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:51:37 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=573</guid>
		<description><![CDATA[In my previous post in this series we looked at how Zend Framework applications can be bootstrapped. We saw the configuration file (application/configs/application.ini) and the Bootstrap class (in application/Bootstrap.php) from a demo blogging application, Postr. What happens once your application is bootstrapped and run? That&#8217;s where Zend Framework&#8217;s routing and Model-View-Controller (MVC) components come in [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/">previous post</a> in this series we looked at how Zend Framework applications can be bootstrapped. We saw the configuration file (<a href="http://github.com/bradley-holt/postr/blob/master/application/configs/application.ini"><code>application/configs/application.ini</code></a>) and the <code>Bootstrap</code> class (in <a href="http://github.com/bradley-holt/postr/blob/master/application/Bootstrap.php"><code>application/Bootstrap.php</code></a>) from a demo blogging application, <a href="http://github.com/bradley-holt/postr">Postr</a>. What happens once your application is bootstrapped and run? That&#8217;s where Zend Framework&#8217;s routing and <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller</a> (MVC) components come in (technically there are a few steps in-between, but we&#8217;ll come back to that in a future post).</p>
<dl>
<dt>Model</dt>
<dd>Your domain objects. There is no <code>Zend_Model</code> since your domain logic is specific to your application. However, there are some best practices that have emerged in the Zend Framework community including <a href="http://martinfowler.com/eaaCatalog/dataMapper.html">Data Mappers</a> (which I&#8217;ll talk about later).</dd>
<dd> See example Models in <a href="http://github.com/bradley-holt/postr/tree/master/application/models/"><code>application/models/</code></a></dd>
<dt>View</dt>
<dd>The presentation layer. The default implementation uses PHP templates called <em>view scripts</em>. View script files have a default suffix of <code>.phtml</code>. There should be no domain logic in your view scripts. By default, there is one view script per controller action (we&#8217;ll see what that means shortly).</dd>
<dd>See example Views in <a href="http://github.com/bradley-holt/postr/tree/master/application/views/"><code>application/views/</code></a></dd>
<dt>Controller</dt>
<dd>Connects the Model and the View. Each Controller contains one or more <em>actions</em>. The Controller&#8217;s job is to interpret input and pass it to the Model and also to provide Model data to the View.</dd>
<dd>See example Controllers in <a href="http://github.com/bradley-holt/postr/tree/master/application/controllers/"><code>application/controllers/</code></a></dd>
</dl>
<p>By default, Zend Framework will route requests based on URI segments as follows:</p>
<pre><code>:controller/:action[/:key/:value]</code></pre>
<p>A few example URIs:</p>
<ul>
<li><code>foo/bar</code> (foo controller, bar action)</li>
<li><code>foo/bar/baz/shaz</code> (foo controller, bar action, baz=shaz)</li>
</ul>
<p>It is possible to customize this routing in pretty much any way conceivable but I&#8217;d suggest sticking with the default routing until you have a good handle on how it works.</p>
<p>In my <a href="http://bradley-holt.com/2010/03/layouts-in-zend-framework/">next post</a> in this series I plan on taking a slight detour so that we can explore a very useful component, <code><a href="http://framework.zend.com/manual/en/zend.layout.html">Zend_Layout</a></code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/02/mvc-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bootstrapping Zend Framework Applications</title>
		<link>http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/</link>
		<comments>http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 05:08:00 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/</guid>
		<description><![CDATA[In my previous post I talked about how the Front Controller pattern is implemented in Zend Framework. We saw how every application request can go through the public/index.php script. Everything that your application does is then eventually called from either the bootstrap() or run() method in Zend_Application.
One of the constructor arguments passed to Zend_Application specified [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://bradley-holt.com/2010/01/front-controller-pattern-in-zend-framework/">previous post</a> I talked about how the Front Controller pattern is implemented in Zend Framework. We saw how every application request can go through the <a href="http://github.com/bradley-holt/postr/blob/master/public/index.php"><code>public/index.php</code></a> script. Everything that your application does is then eventually called from either the <code>bootstrap()</code> or <code>run()</code> method in <code>Zend_Application</code>.</p>
<p>One of the constructor arguments passed to <code>Zend_Application</code> specified the configuration file to use. In the case of the demo blogging application, <a href="http://github.com/bradley-holt/postr">Postr</a>, you&#8217;ll see that the configuration file used is <a href="http://github.com/bradley-holt/postr/blob/master/application/configs/application.ini"><code>application/configs/application.ini</code></a>. If you look at this configuration file you&#8217;ll see that there are four sections: <code>production</code>, <code>staging</code>, <code>testing</code>, and <code>development</code>. The <code>staging</code>, <code>testing</code>, and <code>development</code> sections all inherit from <code>production</code> meaning that they will inherit all of its settings, unless overridden (as is the case, for example, with the <code>phpSettings.display_errors</code> setting in <code>testing</code> and <code>development</code>).</p>
<p>The other constructor argument passed to <code>Zend_Application</code> specified the application&#8217;s environment. For those paying close attention, the environment was actually the first argument and the configuration file was the second argument passed to the constructor of <code>Zend_Application</code>. By default, the demo application is set to run in <code>development</code> mode. This means that the <code>development</code> section from <code>application/configs/application.ini</code> will be used. Remember, <code>development</code> inherits from <code>production</code> so any settings not explicitly overridden from <code>production</code> would be inherited and used.</p>
<p>There&#8217;s quite a bit that can be setup in the configuration file. However, some things may be easier to (or only possible to) setup programmatically. This is where <a href="http://github.com/bradley-holt/postr/blob/master/application/Bootstrap.php"><code>application/Bootstrap.php</code></a> comes in. In your <code>Bootstrap</code> class you can write initializers for various parts of your application. These methods should be <code>protected</code> and their names should begin with <code>_init</code>. Let&#8217;s look at the initializers I&#8217;ve written in the demo application:</p>
<ul>
<li><code>_initViewHeadTitle()</code> first makes sure that the &#8220;view&#8221; resource has been bootstrapped and then gets this resource, which we happen to know is an object of type <code>Zend_View_Abstract</code>. We then set the separator used by the <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headtitle"><code>HeadTitle</code></a> view helper to &#8221; :: &#8220;. This means that each head title appended or prependend will be separated by this string. Next, a title of &#8220;Postr&#8221; is prepended so that this title will be used on every page.</li>
<li><code>_initPagination()</code> simply sets the partial view script to be used by <a href="http://framework.zend.com/manual/en/zend.paginator.html"><code>Zend_Paginator</code></a> (I plan on further explaining <code>Zend_Paginator</code> in another blog post).</li>
<li><code>_initNavigation()</code> sets up our navigation structure using <a href="http://framework.zend.com/manual/en/zend.navigation.html"><code>Zend_Navigation</code></a> (I plan on further explaining <code>Zend_Navigation</code> in another blog post as well).</li>
</ul>
<p>In my <a href="http://bradley-holt.com/2010/02/mvc-in-zend-framework/">next post</a> in this series I plan on taking a look at the Model-View-Controller pattern in Zend Framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Front Controller Pattern in Zend Framework</title>
		<link>http://bradley-holt.com/2010/01/front-controller-pattern-in-zend-framework/</link>
		<comments>http://bradley-holt.com/2010/01/front-controller-pattern-in-zend-framework/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 04:39:00 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/2010/01/front-controller-pattern-in-zend-framework/</guid>
		<description><![CDATA[I recently gave a Zend Framework Introduction presentation at our local PHP Users Group. I built a demo blogging application called Postr that I used as an example throughout the presentation. There was way too much material to cover in the time available so I plan on writing a series of blog posts, each covering [...]]]></description>
			<content:encoded><![CDATA[<p>I recently gave a <a href="http://bradley-holt.com/2010/01/zend-framework-introduction/">Zend Framework Introduction</a> presentation at our local PHP Users Group. I built a demo blogging application called <a href="http://github.com/bradley-holt/postr">Postr</a> that I used as an example throughout the presentation. There was <em>way</em> too much material to cover in the time available so I plan on writing a series of blog posts, each covering a specific area of Zend Framework. Here is the first (and hopefully not the last!) post in this series based on the presentation and demo application.</p>
<p>Like many other frameworks, Zend Framework provides an implementation of the <a href="http://en.wikipedia.org/wiki/Front_Controller_pattern">Front Controller pattern</a>. This means that all HTTP requests can be sent through a centralized point. This allows you to take advantage of Zend Framework&#8217;s routing and <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller (MVC)</a> components, if you so choose. By default this is the <a href="http://github.com/bradley-holt/postr/blob/master/public/index.php"><code>public/index.php</code></a> file (click to see the source code). Note that in Zend Framework only the <code>public</code> directory is accessible to website visitors, all of your other directories should be outside of your document root. You&#8217;ll see several things happening in the <code>public/index.php</code> script:</p>
<ol>
<li>The <code>APPLICATION_PATH</code> constant is defined. This is the full path to the <code>application</code> directory. You&#8217;ll see this constant used later.</li>
<li>The <code>APPLICATION_ENV</code> constant is defined. This will typically be either <code>production</code>, <code>staging</code>, <code>testing</code>, or <code>development</code>. This will be used to determine which configuration section to use.</li>
<li>The <code>library</code> directory is added to the include path. This is so that the <code>Zend</code> library code (if you decide to place it in your <code>library</code> directory) or any other libraries used can be found.</li>
<li>A new instance of <code>Zend_Application</code> is created. Two arguments are passed to its constructor: the application environment (defined in 2) and the location of the configuration file. Typically this is <code>application/configs/application.ini</code>. The application path (defined in 1) is used to provide the absolute path to the configuration file.</li>
<li>The application is then bootstrapped and run. It may seem odd to those used to writing PHP scripts, but <em>everything</em> that happens in your application is subsequently called from either the <code>bootstrap()</code> or <code>run()</code> method in <code>Zend_Application</code>. In fact, this is the essence of the Front Controller pattern.</li>
</ol>
<p>By itself, <code>public/index.php</code> can&#8217;t make sure that all HTTP requests go through it. If you&#8217;re using Apache as your web server then you can use its <a href="http://httpd.apache.org/docs/2.0/misc/rewriteguide.html">rewrite module</a> to do this (other web servers have equivalent functionality). This is typically done in <a href="http://github.com/bradley-holt/postr/blob/master/public/.htaccess"><code>public/.htaccess</code></a>. There are several things happening in this file:</p>
<ol>
<li>First the application environment is set so the application knows if it&#8217;s running in <code>production</code>, <code>staging</code>, <code>testing</code>, or <code>development</code> mode.</li>
<li>In the demo application, I set the default character set to <code>utf-8</code>.</li>
<li>Some environments require you to set a rewrite base. If needed, this is usually the first part of the URI (e.g. just <code><span style="font-family:Georgia,serif;">/</span></code> if your application is the only thing on the web server or <code>/<span style="font-family:Georgia,serif;">postr/</span></code> if your application is in a subdirectory named &#8220;postr&#8221;).</li>
<li>Turn on the rewrite engine.</li>
<li>Don&#8217;t rewrite if the requested file is a regular file with size greater than zero, is a symbolic link, or is a directory. This way static files such as images, CSS files, and JavaScript files aren&#8217;t rewritten.</li>
<li>Otherwise, rewrite the request to <code>index.php</code>.</li>
</ol>
<p>In my <a href="http://bradley-holt.com/2010/01/bootstrapping-zend-framework-applications/">next post</a> in this series I plan on taking a look at what happens during the bootstrapping phase of your Zend Framework application.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/01/front-controller-pattern-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend Framework Introduction</title>
		<link>http://bradley-holt.com/2010/01/zend-framework-introduction/</link>
		<comments>http://bradley-holt.com/2010/01/zend-framework-introduction/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 15:44:00 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BTV]]></category>
		<category><![CDATA[btvphpug]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Vermont]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/2010/01/zend-framework-introduction/</guid>
		<description><![CDATA[Slides from last night&#8217;s Zend Framework Introduction at the Burlington, Vermont PHP Users Group are now available online:
Zend Framework Introduction
View more presentations from Bradley Holt.

The presentation is available under a Creative Commons license.
As I mentioned earlier, there&#8217;s also a demo blogging application called Postr available on GitHub. The application is available under a free/open source [...]]]></description>
			<content:encoded><![CDATA[<p>Slides from last night&#8217;s <a href="http://www.slideshare.net/bradley.holt/zend-framework-introduction">Zend Framework Introduction</a> at the <a href="http://groups.google.com/group/burlington-vt-php">Burlington, Vermont PHP Users Group</a> are now available online:</p>
<div style="width: 425px; text-align: left;" id="__ss_3018057"><a style="margin: 12px 0pt 3px; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; display: block; text-decoration: underline;" href="http://www.slideshare.net/bradley.holt/zend-framework-introduction" title="Zend Framework Introduction">Zend Framework Introduction</a><object style="margin: 0px;" height="355" width="425"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=zendframeworkintroduction-100128163752-phpapp01&amp;stripped_title=zend-framework-introduction"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=zendframeworkintroduction-100128163752-phpapp01&amp;stripped_title=zend-framework-introduction" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="355" width="425"></embed></object>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration: underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration: underline;" href="http://www.slideshare.net/bradley.holt">Bradley Holt</a>.</div>
</div>
<p>The presentation is available under a <a href="http://creativecommons.org/licenses/by/3.0/us/">Creative Commons</a> license.</p>
<p>As I mentioned earlier, there&#8217;s also a demo blogging application called <a href="http://github.com/bradley-holt/postr">Postr</a> available on GitHub. The application is available under a free/open source <a href="http://github.com/bradley-holt/postr/blob/master/LICENSE.txt">New BSD License</a> so feel free to use, redistribute, and/or modify it however you&#8217;d like.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/01/zend-framework-introduction/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Learn Zend Framework</title>
		<link>http://bradley-holt.com/2010/01/learn-zend-framework/</link>
		<comments>http://bradley-holt.com/2010/01/learn-zend-framework/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 16:49:00 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BTV]]></category>
		<category><![CDATA[btvphpug]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Vermont]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/2010/01/learn-zend-framework/</guid>
		<description><![CDATA[At tonight&#8217;s (Thursday, January 28, 2010) Burlington, Vermont PHP Users Group meeting I&#8217;ll be giving a Zend Framework Introduction presentation. I&#8217;ll be covering how to use several features of Zend Framework and common patterns including:

Zend_Tool
Zend_Application
Model-View-Controller (MVC)
Zend_Layout
Action Controllers
View Scripts
Zend_Test
Modeling domain objects
Zend_Form
Zend_Db_Table
Data Mapper
Zend_Paginator
Zend_Date
Zend_Markup
Zend_Navigation
Controller Plugins

I&#8217;ve created a demo blogging application called Postr that I&#8217;ll be using as an [...]]]></description>
			<content:encoded><![CDATA[<p>At tonight&#8217;s (Thursday, January 28, 2010) Burlington, Vermont PHP Users Group meeting I&#8217;ll be giving a <a href="http://btvphpug-2010-01.eventbrite.com/">Zend Framework Introduction</a> presentation. I&#8217;ll be covering how to use several features of Zend Framework and common patterns including:</p>
<ul>
<li><a href="http://framework.zend.com/manual/en/zend.tool.html">Zend_Tool</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.application.html">Zend_Application</a></li>
<li><a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller (MVC)</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.layout.html">Zend_Layout</a></li>
<li>Action Controllers</li>
<li>View Scripts</li>
<li><a href="http://framework.zend.com/manual/en/zend.test.html">Zend_Test</a></li>
<li>Modeling domain objects</li>
<li><a href="http://framework.zend.com/manual/en/zend.form.html">Zend_Form</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.db.table.html">Zend_Db_Table</a></li>
<li><a href="http://martinfowler.com/eaaCatalog/dataMapper.html">Data Mapper</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.paginator.html">Zend_Paginator</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.date.html">Zend_Date</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.markup.html">Zend_Markup</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.navigation.html">Zend_Navigation</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.controller.plugins.html">Controller Plugins</a></li>
</ul>
<p>I&#8217;ve created a demo blogging application called <a href="http://github.com/bradley-holt/postr">Postr</a> that I&#8217;ll be using as an example throughout the presentation. Thanks to <a href="http://foundline.com/people/jason-pelletier">Jason</a> there is some CSS that makes the application much more usable. I will post the presentation to <a href="http://www.slideshare.net/bradley.holt">my SlideShare account</a> after tonight&#8217;s meeting.</p>
<p>The meeting is from 6:00 PM &#8211; 8:00 PM at Office Squared in Burlington, Vermont. If you&#8217;re in the area and interested in attending then you can <a href="http://btvphpug-2010-01.eventbrite.com/">register</a> for free on Eventbrite.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/01/learn-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
