<?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>ThinkRobot &#187; Zend Framework</title>
	<atom:link href="http://think-robot.com/tag/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://think-robot.com</link>
	<description>Design &#38; Development Blog</description>
	<lastBuildDate>Tue, 09 Aug 2011 16:56:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Enable delayed messages in Zend_Queue</title>
		<link>http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/</link>
		<comments>http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 11:57:52 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[queue]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Queue]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=268</guid>
		<description><![CDATA[The default Zend_Queue DB implementation unfortunately does not allow you to pass a timeout value when saving a message on the queue. However not all is lost and you can easily extend the standard Zend classes to add that functionality. All you need is your own Db adapter and Queue class. For the adapter you [...]]]></description>
			<content:encoded><![CDATA[<p>The default Zend_Queue DB implementation unfortunately does not allow you to <strong>pass a timeout value</strong> when saving a message on the queue. However not all is lost and you can easily extend the standard Zend classes to add that functionality.</p>
<p>All you need is your own <strong>Db adapter</strong> and <strong>Queue class</strong>.</p>
<p>For the adapter you only need to overwrite <strong>the send()</strong> function. The highlighted code below is the only change to the original class (2 lines affected&#8230;). You could actually apply this without extending Zend_Queue, but this way will be easier if you ever need to update your Zend library.</p>
<pre><code>&lt;?php

class TS_Queue_Adapter_Db extends Zend_Queue_Adapter_Db {

    /**
     * Send a message to the queue
     *
     * @param  string     $message Message to send to the active queue
     * @param  Zend_Queue $queue
     * @param  Timestamp $timeout
     * @return Zend_Queue_Message
     * @throws Zend_Queue_Exception - database error
     */
    public function send($message, Zend_Queue $queue = null<strong>, $timeout = null</strong>){
        if ($this->_messageRow === null) {
            $this->_messageRow = $this->_messageTable->createRow();
        }

        if ($queue === null) {
            $queue = $this->_queue;
        }

        if (is_scalar($message)) {
            $message = (string) $message;
        }
        if (is_string($message)) {
            $message = trim($message);
        }

        if (!$this->isExists($queue->getName())) {
            require_once 'Zend/Queue/Exception.php';
            throw new Zend_Queue_Exception('Queue does not exist:' . $queue->getName());
        }

        $msg = clone $this->_messageRow;
        $msg->queue_id = $this->getQueueId($queue->getName());
        $msg->created = time();
        $msg->body = $message;
        $msg->md5 = md5($message);
<strong>        $msg->timeout = $timeout;</strong>

        try {
            $msg->save();
        } catch (Exception $e) {
            require_once 'Zend/Queue/Exception.php';
            throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e);
        }

        $options = array(
            'queue' => $queue,
            'data' => $msg->toArray(),
        );

        $classname = $queue->getMessageClass();
        if (!class_exists($classname)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($classname);
        }
        return new $classname($options);
    }
}</code></pre>
<p>Your Queue class only needs to extend the <strong>send()</strong> function again to allow you to pass the timeout through. obviously you can use this class to add other functionality too.</p>
<pre><code>&lt;?php

class TS_Queue extends Zend_Queue {

	/**
	 * Send a message to the queue
	 *
	 * @param  mixed $message message
	 * @return Zend_Queue_Message
	 * @throws Zend_Queue_Exception
	 */
	public function send($message, $timeout = null){
		return $this->getAdapter()->send($message, null, $timeout);
	}
}</code></pre>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/" rel="bookmark">Hitch. Object-oriented event handlers with jQuery</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/" rel="bookmark">Using Zend_Mail and Google SMTP to send emails</a></li><li><a href="http://think-robot.com/2010/12/zend-application-resource-plugin-loading-issues/" rel="bookmark">Zend Application Resource Plugin Loading Issues</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zend Application Resource Plugin Loading Issues</title>
		<link>http://think-robot.com/2010/12/zend-application-resource-plugin-loading-issues/</link>
		<comments>http://think-robot.com/2010/12/zend-application-resource-plugin-loading-issues/#comments</comments>
		<pubDate>Sat, 25 Dec 2010 17:27:17 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=256</guid>
		<description><![CDATA[Admittedly thinking while feeling feverish is slightly impaired, but it took me a little while to figure this one out&#8230; Trying to integrate ZF 1.11 with Doctrine2 to as per this article, I was trying to be a smart-ass and use TS_Resource_EntityManager instead of the ugly looking TS_Resource_Entitymanager. Unfortunately all this got me was this [...]]]></description>
			<content:encoded><![CDATA[<p>Admittedly thinking while feeling feverish is slightly impaired, but it took me a little while to figure this one out&#8230; Trying to integrate ZF 1.11 with Doctrine2 to as per <a href="http://www.spiffyjr.me/2010/11/17/zend-framework-1-11-doctrine-2-lets-play-nice-part-1/" class="external">this article</a>, I was trying to be a smart-ass and use TS_Resource_EntityManager instead of the ugly looking TS_Resource_Entitymanager.</p>
<p>Unfortunately all this got me was this very unhelpful error:</p>
<pre><code>Zend_Application_Bootstrap_Exception with message Resource
matching <strong>"entityManager"</strong> not found</code></pre>
<p>It turns out that although the case of the resource name in the application.ini dosn&#8217;t really matter the class name does not like mixed case. So had to settle with <strong>TS_Resource_Entitymanager</strong> as the plugin name.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2011/06/wordpress-update-permission-issues/" rel="bookmark">WordPress update permission issues</a></li><li><a href="http://think-robot.com/2009/07/redirect-in-controller-plugin-zend-framework-18/" rel="bookmark">Redirect in controller plugin - Zend Framework 1.8</a></li><li><a href="http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/" rel="bookmark">Autloading modular forms & models in Zend Framework 1.8</a></li><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li><li><a href="http://think-robot.com/2010/12/installing-windows-7-guest-on-vmware-7-on-opensuse-113-host/" rel="bookmark">Installing Windows 7 Guest on VMWare 7 on OpenSuse 11.3 Host</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2010/12/zend-application-resource-plugin-loading-issues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend_Date time part and GMT</title>
		<link>http://think-robot.com/2009/12/zend_date-time-part-and-gmt/</link>
		<comments>http://think-robot.com/2009/12/zend_date-time-part-and-gmt/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 21:06:04 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[GMT]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[UK]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Date]]></category>
		<category><![CDATA[ZF]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=215</guid>
		<description><![CDATA[If you live in the UK you might have a surprise waiting in store for you if you use Zend_Date for the time part only. For a while I even thought this was a bug, however digging deeper has shown that actually it&#8217;s Zend_Date that is right, in a way at least. When setting a [...]]]></description>
			<content:encoded><![CDATA[<p>If you live in the UK you might have a surprise waiting in store for you if you use Zend_Date for the time part only. For a while I even thought this was a bug, however digging deeper has shown that actually it&#8217;s Zend_Date that is right, in a way at least.</p>
<p>When setting a time before 1972 &#8211; this is 1970 and 1971 the time part will not be shifted in the UK locale as DST was only introduced in 1972!</p>
<p>This means if you are only calculating times and need the appropriate time adjustment you will need to set a date as no date part in Zend_Date means 1st Jan 1970.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/" rel="bookmark">Display Meetings From Entourage Using GeekTool</a></li><li><a href="http://think-robot.com/2009/04/week-of-the-month-in-mysql/" rel="bookmark">Week of the Month in Mysql</a></li><li><a href="http://think-robot.com/2008/08/opensuse-11-on-lenovo-thinkpad-x61-tablet-pc/" rel="bookmark">openSUSE 11 on Lenovo Thinkpad X61 (tablet pc)</a></li><li><a href="http://think-robot.com/2008/12/strong-ownership-list-approach/" rel="bookmark">Strong ownership list approach</a></li><li><a href="http://think-robot.com/2009/02/how-to-use-the-strong-ownership-list/" rel="bookmark">How To Use the Strong Ownership List</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/12/zend_date-time-part-and-gmt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autloading modular forms &amp; models in Zend Framework 1.8</title>
		<link>http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/</link>
		<comments>http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 21:55:00 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[autload]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=200</guid>
		<description><![CDATA[It&#8217;s not really obvious with the error messages you get, but using a thing like Form_Login does not work out of the box with a modular structure. Which is slightly surprising considering that it&#8217;s inside the default module. I have found examples like the second one below, but no one mentions that you actually declare [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not really obvious with the error messages you get, but using a thing like Form_Login does not work out of the box with a modular structure. Which is slightly surprising considering that it&#8217;s inside the default module.</p>
<p>I have found <a href="http://forums.zend.com/viewtopic.php?f=69&#038;t=1288&#038;start=0" class="external">examples like the second one below</a>, but no one mentions that you actually declare the default namespace too for everything to work.</p>
<pre><code>$autoloader = new Zend_Application_Module_Autoloader(array(
	'namespace' => '',
	'basePath'  => APPLICATION_PATH .'/modules/default',
	'resourceTypes' => array (
		'form' => array(
		'path' => 'forms',
		'namespace' => 'Form',
    ),
	'model' => array(
		'path' => 'models',
		'namespace' => 'Model',
    	),
    )
));

$autoloader = new Zend_Application_Module_Autoloader(array(
	'namespace' => 'Admin_',
	'basePath'  => APPLICATION_PATH .'/modules/admin',
	'resourceTypes' => array (
		'form' => array(
		'path' => 'forms',
		'namespace' => 'Form',
    ),
	'model' => array(
		'path' => 'models',
		'namespace' => 'Model',
    	),
    )
));</code></pre>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/02/zend-framework-decorators-labels-and-checkboxes/" rel="bookmark">Zend Framework Decorators - Labels and Checkboxes</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2011/08/edit-bios-in-lenovo-thinkpad-x220t/" rel="bookmark">Edit BIOS in Lenovo ThinkPad x220t</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Redirect in controller plugin &#8211; Zend Framework 1.8</title>
		<link>http://think-robot.com/2009/07/redirect-in-controller-plugin-zend-framework-18/</link>
		<comments>http://think-robot.com/2009/07/redirect-in-controller-plugin-zend-framework-18/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 21:53:02 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=195</guid>
		<description><![CDATA[If you need to redirect while inside a controller plugin, for example in preDispatch() here is a quick way to do it: $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->gotoUrl('/login/'); Related Articles:Zend Application Resource Plugin Loading IssuesHitch. Object-oriented event handlers with jQueryUsing Zend_Mail and Google SMTP to send emailsAutloading modular forms &#038; models in Zend Framework 1.8Zend_Db_Select multiple table [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to redirect while inside a controller plugin, for example in preDispatch() here is a quick way to do it:</p>
<pre><code>$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('/login/');
</code></pre>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2010/12/zend-application-resource-plugin-loading-issues/" rel="bookmark">Zend Application Resource Plugin Loading Issues</a></li><li><a href="http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/" rel="bookmark">Hitch. Object-oriented event handlers with jQuery</a></li><li><a href="http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/" rel="bookmark">Using Zend_Mail and Google SMTP to send emails</a></li><li><a href="http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/" rel="bookmark">Autloading modular forms & models in Zend Framework 1.8</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/07/redirect-in-controller-plugin-zend-framework-18/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend_Db_Select multiple table joins explained</title>
		<link>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/</link>
		<comments>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 22:52:23 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Db_select]]></category>
		<category><![CDATA[Zend_Db_Table_Abstract]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=156</guid>
		<description><![CDATA[It sounds like a simple task &#8211; retrieve the result from a join SQL query. Unusually you can even find documentation on the official Zend Framework site explaining how to put together a query that will return the results from a JOIN query. Unfortunately when it actually comes to putting theory into practice any Zend [...]]]></description>
			<content:encoded><![CDATA[<p>It sounds like a simple task &#8211; retrieve the result from a join SQL query. Unusually you can even find <a href="http://framework.zend.com/manual/en/zend.db.select.html" target="_blank">documentation on the official Zend</a> Framework site explaining how to put together a query that will return the results from a JOIN query. Unfortunately when it actually comes to putting theory into practice any Zend newcomer can run into several problems.<span id="more-156"></span></p>
<h2>You Think It&#8217;s Easy&#8230;</h2>
<p>For starters rather than use &#8220;raw&#8221; <strong>Zend_Db_Select</strong>:</p>
<pre><code>$select = $db-&gt;select();</code></pre>
<p>I wanted to derive the select from my <strong>Zend_Db_Table_Abstract</strong>, like so:</p>
<pre><code>
class Model_Db_Website extends Zend_Db_Table_Abstract {
	(...)
	public function fetchWebsites(){
		$select = $this-&gt;select();
		$select-&gt;join(array('whi' =&gt; 'website_has_images), 'whi.website_id = websites.website_id')
		return $this-&gt;fetchAll($select);
	}
}
</code></pre>
<p>This was more or less the example I found in the documentation. You might be wondering what is wrong with this picture. At first it seems like there is nothing missing. The table fields and the table name (for the FROM clause) are taken from the table class, and we have provided all the necessary JOIN details&#8230; However instead of the expected result, you an error message!</p>
<pre class="msg"><code><strong>Message:</strong> Select query cannot join with another table </code></pre>
<h2>The Solution</h2>
<p>Not to prolong any more here is the final bit, which we will walk-through below.</p>
<pre><code>
class Model_Db_Website extends Zend_Db_Table_Abstract {
	(...)
	public function fetchWebsites(){
		$select = $this-&gt;select();
		$select<strong>-&gt;setIntegrityCheck(false)</strong>
			<strong>-&gt;from($this-&gt;_name, '*')</strong>
			-&gt;join(
				array('whi' =&gt; 'website_has_images'),
				'whi.website_id = websites.website_id'<strong>, '*'</strong>
    			);
		return $this-&gt;fetchAll($select);
	}
}
</code></pre>
<p>The first thing you need to do is get rid of the error. This one has been mentioned online quite a lot and is easy to fix by applying:</p>
<pre class="msg"><code>-&gt;setIntegrityCheck(false)</code></pre>
<p>The code above makes your result set read only, but allows you to do joins.</p>
<p>Now for the less obvious bits. Once the above problem is fixed you will notice that your results only include the join table fields. To fix this add the final parameter to the list &#8211; either a &#8216;*&#8217; or an explicit list of fields.</p>
<p><strong>Many sites suggest using an empty array, though this causes the result set to return only main table fields&#8230;</strong></p>
<p>The &#8216;*&#8217; is not enough though. You still need the from declaration <strong>-&gt;from($this-&gt;_name, &#8216;*&#8217;)</strong>, as without you will still be getting just the join table fields.</p>
<p>So there you go, it took me quite a bit of fiddling and randomly changing the parameter set to arrive at the final solution. Hope it saves you the hassle too!</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2011/03/jquery-multiple-events-without-default-behaviour/" rel="bookmark">jQuery Multiple Events Without Default Behaviour</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2009/04/week-of-the-month-in-mysql/" rel="bookmark">Week of the Month in Mysql</a></li><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zend Framework Decorators &#8211; Labels and Checkboxes</title>
		<link>http://think-robot.com/2009/02/zend-framework-decorators-labels-and-checkboxes/</link>
		<comments>http://think-robot.com/2009/02/zend-framework-decorators-labels-and-checkboxes/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 11:16:12 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=20</guid>
		<description><![CDATA[Very often it is the smallest things that annoy us the most. It took me a while to figure out why the placement parameter was not changing anything. I started of with the following: 'decorators' =&#62; array( array('Label'), array('ViewHelper') ) Unfortunately switching the order between Label and ViewHelper did not change the order of elements. [...]]]></description>
			<content:encoded><![CDATA[<p>Very often it is the smallest things that annoy us the most. It took me a while to figure out why the placement parameter was not changing anything. I started of with the following:</p>
<pre>'decorators' =&gt; array(
	array('Label'),
	array('ViewHelper')
)</pre>
<p><span id="more-20"></span><br />
Unfortunately switching the order between Label and ViewHelper did not change the order of elements. So I found this parameter called &#8220;placement&#8221;.</p>
<pre>'decorators' =&gt; array(
	array('Label', array('placement' =&gt; 'APPEND')),
	array('ViewHelper')
)</pre>
<p>It can take two values: PREPEND or APPEND. At this point however I did not realize that now the order of Label and ViewHelper did matter. Only the order below will make any difference to the html elements order.</p>
<pre>'decorators' =&gt; array(
	array('ViewHelper'),
	array('Label', array('placement' =&gt; 'APPEND'))
)</pre>
<p>This finally resulted in the desired effect.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/" rel="bookmark">Autloading modular forms & models in Zend Framework 1.8</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/" rel="bookmark">Using Zend_Mail and Google SMTP to send emails</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/02/zend-framework-decorators-labels-and-checkboxes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Zend_Mail and Google SMTP to send emails</title>
		<link>http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/</link>
		<comments>http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 19:15:11 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[emails]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=21</guid>
		<description><![CDATA[You can set this globally, for example in your bootstrap.php file: $tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array( 'auth' =&#62; 'login', 'username' =&#62; 'YOUR_USERNAME@gmail.com', 'password' =&#62; 'YOUR_PASSWORD', 'ssl' =&#62; 'ssl', 'port' =&#62; 465) ); Zend_Mail::setDefaultTransport($tr); And later just use the normal Zend_Mail function as usual: $mail = new Zend_Mail(); $mail-&#62;setBodyHtml('Your html email here.'); $mail-&#62;addTo('send_to@mail.com'); $mail-&#62;setSubject('Mail Subject'); $mail-&#62;setFrom('from@mail.com'); [...]]]></description>
			<content:encoded><![CDATA[<p>You can set this globally, for example in your bootstrap.php file:</p>
<pre>$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array(
	'auth' =&gt; 'login',
	'username' =&gt; 'YOUR_USERNAME@gmail.com',
	'password' =&gt; 'YOUR_PASSWORD',
	'ssl' =&gt; 'ssl',
	'port' =&gt; 465)
);
Zend_Mail::setDefaultTransport($tr);</pre>
<p><span id="more-21"></span></p>
<p>And later just use the normal Zend_Mail function as usual:</p>
<pre>$mail = new Zend_Mail();
$mail-&gt;setBodyHtml('Your html email here.');
$mail-&gt;addTo('send_to@mail.com');
$mail-&gt;setSubject('Mail Subject');
$mail-&gt;setFrom('from@mail.com');
$mail-&gt;send();</pre>
<p>To quickly explain the settings:<br />
You need to set the authentication type to login, and provide your Google email and password, as obviously to prevent spam Google needs some verification of who you are. Then we specify the ssl type: Zend supports tls and ssl, and for Google we need to specify the later one. This also means that we need to use port <strong>465</strong> instead of the standard <strong>25</strong>.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2010/12/php_auth_user-and-php_auth_pw-is-null/" rel="bookmark">PHP_AUTH_USER and PHP_AUTH_PW is null</a></li><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li><li><a href="http://think-robot.com/2008/08/server-error-500-htaccess-require-valid-user/" rel="bookmark">Server Error 500 - htaccess require valid-user</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/" rel="bookmark">Display Meetings From Entourage Using GeekTool</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2008/12/using-zend_mail-and-google-smtp-to-send-emails/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

