<?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>Darryl E. Clarke &#187; php</title>
	<atom:link href="http://darrylclarke.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://darrylclarke.com</link>
	<description>Linux, PHP, MySQL, Apache, Development and More . . .</description>
	<lastBuildDate>Wed, 13 Jan 2010 18:05:36 +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>ZF Tip: Don&#8217;t use &#8216;index&#8217; as a module name.</title>
		<link>http://darrylclarke.com/2009/12/13/zf-tip-dont-use-index-as-a-module-name/</link>
		<comments>http://darrylclarke.com/2009/12/13/zf-tip-dont-use-index-as-a-module-name/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 02:07:52 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[pointless]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=269</guid>
		<description><![CDATA[I&#8217;ve been using Zend Framework for a while and when I do my own sites things always work as expected.  But a couple of times in the past I&#8217;ve had the honor of working on other sites with other people that have lead me to a few &#8216;wtf?&#8217; issues.
The most recent one was as to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Zend Framework for a while and when I do my own sites things always work as expected.  But a couple of times in the past I&#8217;ve had the honor of working on other sites with other people that have lead me to a few &#8216;wtf?&#8217; issues.</p>
<p>The most recent one was as to why the shorter urls ie: &#8220;/index/pants&#8221; would not work.  It would always complain and blow up that the controller &#8216;pants&#8217; doesn&#8217;t exist.  Even though I know for a fact that I want the index controller in the default module and the action &#8216;pants&#8217;&#8230;<span id="more-269"></span></p>
<p>The problem with naming your default, or any module &#8216;index&#8217; is the way ZF matches and routes the request.  If you have a module called &#8216;index&#8217; then any request that begins with &#8216;/index&#8217; will get routed to it.  Even if this isn&#8217;t what you want.  Typically  when I have actions like &#8216;about&#8217; or &#8216;contact&#8217;, they reside in my default module and are easily accessed by &#8216;/index/about&#8217; or &#8216;/index/contact&#8217; &#8211; when a module exists called &#8216;index&#8217; these shorter links don&#8217;t work and I&#8217;d need &#8216;/index/index/about&#8217; or &#8216;/index/index/contact&#8217; &#8211; these suck and thus you should never have &#8216;index&#8217; as a module name.</p>
<p>The point: If your default module has to be in the URL to access these default actions, you&#8217;re not using the &#8216;default&#8217; module properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/12/13/zf-tip-dont-use-index-as-a-module-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>All I Need is REST, Vimeo, Flickr, Zend and More</title>
		<link>http://darrylclarke.com/2009/07/12/all-i-need-is-rest-vimeo-flickr-zend-and-more/</link>
		<comments>http://darrylclarke.com/2009/07/12/all-i-need-is-rest-vimeo-flickr-zend-and-more/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 18:18:45 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[restful]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[vimeo]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=208</guid>
		<description><![CDATA[Here&#8217;s my skeleton for my magical REST interface. It&#8217;s still missing a lot of method calls for Flickr and Vimeo, but the guts are there and the remaining methods will be done in priority when I need them.  Right now it supports automatic caching and logging via simple options.
At some point I&#8217;ll probably put it [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my skeleton for my magical <a href="http://darrylclarke.com/wp-content/uploads/2009/07/dec-library.tar.gz">REST interface</a>. It&#8217;s still missing a lot of method calls for Flickr and Vimeo, but the guts are there and the remaining methods will be done in priority when I need them.  Right now it supports automatic caching and logging via simple options.</p>
<p>At some point I&#8217;ll probably put it on a public SVN repository, but for now you can have the tarball.  There&#8217;s a README in the file with a simple sample. And the source is pretty self explanatory so you should be able to figure it out if you want to.</p>
<p>The remainder of the work will be done in the order I see fit.  Likely read-only methods (most of the getters) Authentication and write methods will be much much later.</p>
<p>I&#8217;ll also add more RESTful interfaces as I need them.  Probably Facebook soon, Twitter later.  Who knows.</p>
<p>Drop your comments here if you&#8217;ve got any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/07/12/all-i-need-is-rest-vimeo-flickr-zend-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Java Bridge vs. Zend Platform Java Bridge</title>
		<link>http://darrylclarke.com/2009/06/05/php-java-bridge-vs-zend-platform-java-bridge/</link>
		<comments>http://darrylclarke.com/2009/06/05/php-java-bridge-vs-zend-platform-java-bridge/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 18:50:56 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[java bridge]]></category>
		<category><![CDATA[workarounds]]></category>
		<category><![CDATA[zend platform]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=194</guid>
		<description><![CDATA[A long time ago I posted some instructions on installing PHP/Java Bridge on Ubuntu and that post is getting quite a few reads, so I figured I&#8217;d post a follow up on how it was used.
Over the last year I had been using a Java Bridge from a Zend Framework application to access a Java [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago I posted some instructions on installing <a href="http://darrylclarke.com/2008/03/04/installing-php-java-bridge-on-ubuntu/">PHP/Java Bridge on Ubuntu</a> and that post is getting quite a few reads, so I figured I&#8217;d post a follow up on how it was used.</p>
<p>Over the last year I had been using a Java Bridge from a Zend Framework application to access a Java only API.  And really, between the two bridges there are no differences.  They both work identical, they both work great.  Would I pay Zend for Zend Platform&#8217;s Enterprise license? No.  Why? Because both bridges perform the same.  The only differences are:</p>
<ol>
<li>Zend&#8217;s Java bridge already has a function called <em>java_require</em> and the open source PHP/Java Bridge needs you to include a file.</li>
<li>PHP/Java Bridge has a <em>java_cast</em> function, and you need it.  Zend&#8217;s Java Bridge does not have, or need this.</li>
</ol>
<p>With these two differences all you need is a little code in your bootstrap (or somewhere else useful) to cover them and all is golden. Your app should work with both Java Bridges without any issue.</p>
<pre name="code" class="php">
/* no java_require() include the java.inc for PHP/Java Bridge */
if ( ! function_exists('java_require') ) {
    include "java/Java.inc";
}

/* declare this, it doesn't exist with Zend Java, but is needed for PHP/Java Bridge */
if ( ! function_exists('java_cast')) {
    function java_cast($whatever) {
        return $whatever;
    }
}</pre>
<p>There&#8217;s probably a more graceful way of checking and doing this but that&#8217;s it, and it&#8217;s worked on a multi tiered build environment for over a year now.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/06/05/php-java-bridge-vs-zend-platform-java-bridge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.8 and Beyond</title>
		<link>http://darrylclarke.com/2009/04/18/zend-framework-18-and-beyond/</link>
		<comments>http://darrylclarke.com/2009/04/18/zend-framework-18-and-beyond/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 15:34:21 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=102</guid>
		<description><![CDATA[Zend Framework 1.8 is almost ready and as such, it&#8217;s time for me to look into what it&#8217;s got.
There&#8217;s a good listing of what&#8217;s new over here and really on the surface it doesn&#8217;t look like much. But as a person who&#8217;s been using ZF for quite some time, I&#8217;m really happy to see some [...]]]></description>
			<content:encoded><![CDATA[<p>Zend Framework 1.8 is almost ready and as such, it&#8217;s time for me to look into what it&#8217;s got.</p>
<p>There&#8217;s a good listing of what&#8217;s new <a href="http://weierophinney.net/matthew/archives/214-Zend-Framework-1.8-PREVIEW-Release.html" target="_blank">over here</a> and really on the surface it doesn&#8217;t look like much. But as a person who&#8217;s been using ZF for quite some time, I&#8217;m really happy to see some integrated tools for creating the application structure in a quick and easy way. As long as module creation support makes it in for 1.8, things will be great.</p>
<p>Aside from that, I&#8217;ll be interested in seeing what Zend_Navigation has to offer.  Seeing as I&#8217;ve had numerous instances with global navigation, crumbs, module based navigation and I&#8217;ve had to create something each time &#8211; a single one-stop-shop for nav items could prove to be very useful.</p>
<p>Here&#8217;s lookin&#8217; to the future.</p>
<p><strong>Update</strong>: <a href="http://devzone.zend.com/article/4524-Zend-Framework-1.8.0-Released" target="_blank">Zend Framework 1.8 is officially released</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/04/18/zend-framework-18-and-beyond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Thoughts on MVC, Bad Design and Confusion</title>
		<link>http://darrylclarke.com/2009/03/14/some-thoughts-on-mvc-bad-design-and-confusion/</link>
		<comments>http://darrylclarke.com/2009/03/14/some-thoughts-on-mvc-bad-design-and-confusion/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 21:32:12 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[concept]]></category>
		<category><![CDATA[flamebait]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=90</guid>
		<description><![CDATA[I was reading a post over here about why the ActionStack in Zend Framework is evil.  And I agree. I&#8217;ve used ActionStack before in a few older ZF sites (where better alternatives weren&#8217;t ready or I just didn&#8217;t know about them) but now as the framework has progressed there are many better alternatives to get [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading a post over here about why the ActionStack in Zend Framework <a href="http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/" target="_blank">is evil</a>.  And I agree. I&#8217;ve used ActionStack before in a few older ZF sites (where better alternatives weren&#8217;t ready or I just didn&#8217;t know about them) but now as the framework has progressed there are many better alternatives to get other &#8216;actions&#8217; to be executed on every request.</p>
<p>That better alternative is to simply <strong>not stack actions</strong>. One practice that I&#8217;ve been bringing into habit over the last year or so with my coding is to keep my controllers thinned out. As Ryan states: <strong>Fat Models, Thin Controllers</strong>.  And as things have rolled out over the last few months, I&#8217;ve discovered that is a Good Thing™.</p>
<p>Skinny supermodels beware, your jobs are at risk&#8230;</p>
<p><span id="more-90"></span>The hardest part of making your models fat would be understanding what the Model really is in ZF&#8217;s implementation of MVC. The view is clear, the controller is clear, but what <em>is</em> the model?  With a typical MVC the model is supposed to imply business logic, rules, data access and quite literally everything your application needs to do.  With a well designed model you&#8217;ll very easily have <acronym title="Don't Repeat Yourself">DRY</acronym> code and hopefully efficient code.</p>
<p>Zend doesn&#8217;t enforce a specific model to follow, so as a developer that&#8217;s something that you have to decide on.</p>
<p>If you have fat controllers your model may be completely swallowed by the controller itself.  If you&#8217;re a fat controller designer chances are you&#8217;ve got a lot of repetitive code. If your application happens to have database access, and a few classes that extend Zend_Db_Table, chances are the extent of your model is just those classes.  Your model will be very thin and, really, in my opinion, quite useless.  This is how I started with Zend Framework.  And when I was doing this, I was forced to use ActionStack and other strange techniques to get certain things to happen.</p>
<p>As time progressed and I started working on some larger projects, I realized that these fat controllers weren&#8217;t going to work very well.  I started transitioning to a fat model and lightening the load on my controllers.  As part of this transition I started creating classes with useful, reusable methods.  Things such as <strong>User::getInfo()</strong> or <strong>Navigation::getGlobalNav()</strong> which are pretty self explanitory just by name.  These methods would return usable arrays or iterable objects that would be passed directly into the view via the controller.  The advantage of returning raw data is that the methods don&#8217;t need, or even care, about the view.</p>
<p>Using the above,  I could have a controller that&#8217;s as simple as this, where the view handles the raw data that gets returned.  All the logic is outside, in a nice tidy, fat model:</p>
<pre>&lt;?php
class UserController extends Zend_Controller_Action
{
    function init()
    {
        Zend_Loader::loadClass('Navigation');
        $this-&gt;view-&gt;globalNav = Navigation::getGlobalNav();
    }

    function indexAction()
    {
        Zend_Loader::loadClass('User');
        $this-&gt;view-&gt;userInfo = User::getInfo();
    }
}</pre>
<p>Hopefully that makes some sense.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/03/14/some-thoughts-on-mvc-bad-design-and-confusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.7.5 Released</title>
		<link>http://darrylclarke.com/2009/02/22/zend-framework-175-released/</link>
		<comments>http://darrylclarke.com/2009/02/22/zend-framework-175-released/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 20:11:45 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=68</guid>
		<description><![CDATA[Zend Framework 1.7.5 was released just a short while ago.  While there&#8217;s not much with regards to features, there&#8217;s an interesting update to the view renderer and local file injection attacks.
I&#8217;m guilty of using this style of inclusion in some cases.  Sometimes it&#8217;s just easier. I guess it&#8217;s time to re-think how I do what [...]]]></description>
			<content:encoded><![CDATA[<p>Zend Framework 1.7.5 was released just a short while ago.  While there&#8217;s not much with regards to features, there&#8217;s an <a href="http://weierophinney.net/matthew/archives/206-Zend-Framework-1.7.5-Released-Important-Note-Regarding-Zend_View.html" target="_blank">interesting update</a> to the view renderer and local file injection attacks.</p>
<p>I&#8217;m guilty of using this style of inclusion in some cases.  Sometimes it&#8217;s just easier. I guess it&#8217;s time to re-think how I do what I do in these very few and rare cases.  No more &#8216;../&#8217; in my render statements!</p>
<p>Thanks to <a href="http://www.zendframeworkinaction.com/2009/02/19/zend-framework-175/" target="_blank">Zend Framework In Action</a> for the quick update.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/02/22/zend-framework-175-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why is XML Such a Pain in JavaScript?</title>
		<link>http://darrylclarke.com/2009/02/07/why-is-xml-such-a-pain-in-javascript/</link>
		<comments>http://darrylclarke.com/2009/02/07/why-is-xml-such-a-pain-in-javascript/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 16:14:35 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/?p=52</guid>
		<description><![CDATA[Why is it that when one tries to parse some fairly simple xml:
&#60;placemarks&#62;
	&#60;placemark&#62;
		&#60;name&#62;Placemark 1&#60;/name&#62;
		&#60;latitude&#62;-79.00&#60;/latitude&#62;
		&#60;longiude&#62;42.00&#60;/longitude&#62;
	&#60;/placemark&#62;
	&#60;placemark&#62;
		&#60;name&#62;Placemark 2&#60;/name&#62;
		&#60;latitude&#62;-129.00&#60;/latitude&#62;
		&#60;longiude&#62;43.00&#60;/longitude&#62;
	&#60;/placemark&#62;
&#60;/placemarks&#62;
For example, iterating through all the placemarks and extracting the names, lats and longs using javascript is a very tedious affair. In fact, I&#8217;ve found it almost pointless to even try without my head exploding.
All of the examples I&#8217;ve seen that [...]]]></description>
			<content:encoded><![CDATA[<p>Why is it that when one tries to parse some fairly simple xml:</p>
<pre>&lt;placemarks&gt;
	&lt;placemark&gt;
		&lt;name&gt;Placemark 1&lt;/name&gt;
		&lt;latitude&gt;-79.00&lt;/latitude&gt;
		&lt;longiude&gt;42.00&lt;/longitude&gt;
	&lt;/placemark&gt;
	&lt;placemark&gt;
		&lt;name&gt;Placemark 2&lt;/name&gt;
		&lt;latitude&gt;-129.00&lt;/latitude&gt;
		&lt;longiude&gt;43.00&lt;/longitude&gt;
	&lt;/placemark&gt;
&lt;/placemarks&gt;</pre>
<p>For example, iterating through all the <em>placemarks</em> and extracting the names, lats and longs using javascript is a very tedious affair. In fact, I&#8217;ve found it almost pointless to even try without my head exploding.</p>
<p><span id="more-52"></span>All of the examples I&#8217;ve seen that parse XML in javascript with any ease all use the attributes of XML items.  If this were the case, I&#8217;d be using an XML file that looks something like this.</p>
<pre>&lt;placemarks&gt;
	&lt;placemark name="Placemark 1" latitude="-79.00" longiude="42.00" /&gt;
	&lt;placemark name="Placemark 2" latitude="-129.00" longiude="43.00" /&gt;
&lt;/placemarks&gt;</pre>
<p>That&#8217;s a <strong>piece of cake</strong> with JavaScript, but you know what? Using attributes for every bit of data you want isn&#8217;t that bright of an idea.  The schema isn&#8217;t very extensible if you use attributes for all of your data points.  What if I want to add a &#8216;<em>description</em>&#8216; to each point, and I want that description to contain an HTML fragment? Using an attribute is out of the question for that.</p>
<p>So, What&#8217;s an easy way to parse my well built XML file?  I don&#8217;t know yet, I&#8217;m still looking for that answer.  For the time being I&#8217;m using Zend Framework&#8217;s Zend_Json to encode the XML output that I generate and return a JSON object.  Maybe this is actually the best way to do it.  After all, JavaScript parsing JSON is fast and super-easy.</p>
<pre>Zend_Loader::loadClass('Zend_Json');
$json = Zend_Json::fromXML($xml);</pre>
<p>And, pewf I&#8217;ve got JSON.</p>
<p>I guess the whole point of this is, does anybody actually know a good way to to parse XML with JavaScript without using attributes for all the datapoints?</p>
<p>Until then, JSON it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/02/07/why-is-xml-such-a-pain-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework, FireBug, FirePHP and Debuggin&#8217;</title>
		<link>http://darrylclarke.com/2009/02/01/zend-framework-firebug-firephp-and-debuggin/</link>
		<comments>http://darrylclarke.com/2009/02/01/zend-framework-firebug-firephp-and-debuggin/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 22:54:56 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/2009/02/01/zend-framework-firebug-firephp-and-debuggin/</guid>
		<description><![CDATA[I finally got around to implementing some debugging my applications. By debugging, I mean something more useful than random &#8216;echo&#8216; and &#8216;exit&#8216; statements littering my code.
I found a nice post by Christoph Dorn with a few nice pointers on how to integrate FireBug and FirePHP using Zend_Log and Zend_Log_Writer_Firebug.
My only addition was the use of [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to implementing some debugging my applications. By debugging, I mean something more useful than random &#8216;<em>echo</em>&#8216; and &#8216;<em>exit</em>&#8216; statements littering my code.</p>
<p>I found a nice post by <a href="http://www.christophdorn.com/Blog/2008/09/02/firephp-and-zend-framework-16/" target="_blank">Christoph Dorn</a> with a few nice pointers on how to integrate FireBug and FirePHP using Zend_Log and Zend_Log_Writer_Firebug.</p>
<p>My only addition was the use of a &#8216;debug&#8217; flag that I use in my applications.  Basically, if it is set to true the logwriter will work, if it&#8217;s false, it won&#8217;t write anything.</p>
<pre>if ($config-&gt;debug === '1') {
	$writer-&gt;setEnabled(true);
	$frontController-&gt;throwExceptions(true);
} else {
	$writer-&gt;setEnabled(false);
	$frontController-&gt;throwExceptions(false);
}</pre>
<p>That little snippit in my bootstrap makes all the magic happen.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/02/01/zend-framework-firebug-firephp-and-debuggin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geocodes Made Easy</title>
		<link>http://darrylclarke.com/2009/01/24/geocodes-made-easy/</link>
		<comments>http://darrylclarke.com/2009/01/24/geocodes-made-easy/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 20:56:30 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/2009/01/24/geocodes-made-easy/</guid>
		<description><![CDATA[Using my Google Maps API key I can geocode almost anything*.
And with Zend Framework, it&#8217;s f&#8217;n damn simple!
Zend_Loader::loadClass('Zend_Rest_Client');
$rest = new Zend_Rest_Client('http://maps.google.com/maps/geo');
//?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&#38;output=json&#38;oe=utf8&#38;sensor=true_or_false&#38;key=your_api_key

$rest-&#62;key('YOUR_API_KEY');
$rest-&#62;q('1600 Amphitheatre Parkway, Mountain View, CA');
$rest-&#62;output('xml');
$rest-&#62;oe('utf8');

$result =  $rest-&#62;get();
// the whole $result is a SimpleXML object
print_r((string)$result-&#62;Response-&#62;Placemark-&#62;Point-&#62;coordinates);
And that&#8217;s it.  Save the results someplace useful so you don&#8217;t have to hammer the shizzle out of Google (there [...]]]></description>
			<content:encoded><![CDATA[<p>Using my Google Maps API key I can geocode almost anything*.</p>
<p>And with Zend Framework, it&#8217;s f&#8217;n damn simple!</p>
<pre>Zend_Loader::loadClass('Zend_Rest_Client');
$rest = new Zend_Rest_Client('http://maps.google.com/maps/geo');
//?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&amp;output=json&amp;oe=utf8&amp;sensor=true_or_false&amp;key=your_api_key

$rest-&gt;key('YOUR_API_KEY');
$rest-&gt;q('1600 Amphitheatre Parkway, Mountain View, CA');
$rest-&gt;output('xml');
$rest-&gt;oe('utf8');

$result =  $rest-&gt;get();
// the whole $result is a SimpleXML object
print_r((string)$result-&gt;Response-&gt;Placemark-&gt;Point-&gt;coordinates);</pre>
<p>And that&#8217;s it.  Save the results someplace useful so you don&#8217;t have to hammer the shizzle out of Google (there are query limitations per key).</p>
<p>* I mean almost anything, because you cannot geocode a UK Postal Code, because the Queen and her Royal Mail owns the copyrights on it. Silly, I know.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/01/24/geocodes-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rendering Loops, the Easy Way</title>
		<link>http://darrylclarke.com/2009/01/20/rendering-loops-the-easy-way/</link>
		<comments>http://darrylclarke.com/2009/01/20/rendering-loops-the-easy-way/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 07:08:27 +0000</pubDate>
		<dc:creator>Darryl Clarke</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://darrylclarke.com/2009/01/20/rendering-loops-the-easy-way/</guid>
		<description><![CDATA[I&#8217;d like to say I&#8217;m an idiot and should have known how to do this a long long time ago, but since the Zend Framework is so huge &#8211; I&#8217;m letting it slip by.
Normally I&#8217;ve always rendered repetitive data by using a foreach on my objects or arrays and then within that foreach I usually [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to say I&#8217;m an idiot and should have known how to do this a long long time ago, but since the Zend Framework is so huge &#8211; I&#8217;m letting it slip by.</p>
<p>Normally I&#8217;ve always rendered repetitive data by using a <em>foreach</em> on my objects or arrays and then within that <em>foreach</em> I usually render an external file (when I&#8217;m not lazy), or even just have a large chunk of html within my view scripts.  When it comes to bigger sites, I want the html fragments to be as simplified and manageable as possible&#8230;</p>
<p><span id="more-41"></span></p>
<p>That&#8217;s where the Parital and PartialLoop view helpers in Zend Framework come in to play.</p>
<p>Before I would have something like this littered throughout:</p>
<pre>&lt;ul&gt;
&lt;?php
foreach ($this-&gt;rowset as $row):
    echo '&lt;li&gt;' . $row-&gt;title . '&lt;/li&gt;';
endforeach;
?&gt;
&lt;/ul&gt;</pre>
<p>Now that I&#8217;ve noted the Partial and PartialLoop helpers I can do this:</p>
<pre>&lt;ul&gt;
&lt;?php
echo $this-&gt;partialLoop('_my_list.phtml', $this-&gt;rowset);
?&gt;
&lt;/ul&gt;</pre>
<p>And get the same result.  As long as &#8216;_my_list.phtml&#8217; exists in the module scripts folder and contains the necessary fragment to output data from the row, it should work as planned.</p>
<p>One thing to note though, is that the scope of each row that you are iterating through is that of the partial script fragment (<em>$this</em>) &#8211; in my original all included way, the context of the row was &#8216;<em>$row</em>&#8216;</p>
<p>My fragment would look like this:</p>
<pre>&lt;li&gt;&lt;?php echo $this-&gt;title; ?&gt;&lt;/li&gt;</pre>
<p>The partialLoop also has a counter that allows you to know what row you are on and do things such as alternate background colours, repeat headers, or whatever else you feel necessary.  Super handy for data set listings.  I hope that makes some sense.</p>
]]></content:encoded>
			<wfw:commentRss>http://darrylclarke.com/2009/01/20/rendering-loops-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
