<?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"
	>

<channel>
	<title>Peacock Suit</title>
	<atom:link href="http://peacocksuit.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://peacocksuit.com/blog</link>
	<description></description>
	<pubDate>Mon, 17 Nov 2008 15:42:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Zend Framework 1.7.0 is now available!</title>
		<link>http://peacocksuit.com/blog/2008/11/17/zend-framework-1-7-0/</link>
		<comments>http://peacocksuit.com/blog/2008/11/17/zend-framework-1-7-0/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 15:37:43 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend Framework]]></category>

		<category><![CDATA[Zend_Form_Element_Select]]></category>

		<category><![CDATA[Zend Framework Performance Guide]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=137</guid>
		<description><![CDATA[Almost three hundred bugs fixed and many welcome additions, one of which is the new Performance Guide in the reference manual.
1.7.0 can  be downloaded from the Zend Framework download site.
Well done ZF Team!
]]></description>
			<content:encoded><![CDATA[<p>Almost three hundred bugs <a title="Zend Framework 1.7.0 bug fixes" href="http://framework.zend.com/issues/secure/IssueNavigator.jspa?requestId=10903">fixed</a> and many welcome additions, one of which is the new <a title="Zend Framework Performance Guide" href="http://framework.zend.com/manual/en/performance.html">Performance Guide</a> in the reference manual.</p>
<p><em>1.7.0</em> can  be downloaded from the Zend Framework <a title="Zend Framework 1.7.0 Download Page" href="http://framework.zend.com/download/latest">download site.</a></p>
<p><strong>Well done ZF Team!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/11/17/zend-framework-1-7-0/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse PDT 2.0 All-In-One (BETA) Available</title>
		<link>http://peacocksuit.com/blog/2008/11/15/eclipse-pdt-20-all-in-one-beta-available/</link>
		<comments>http://peacocksuit.com/blog/2008/11/15/eclipse-pdt-20-all-in-one-beta-available/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 15:30:12 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Eclipse PDT]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=127</guid>
		<description><![CDATA[All-In-One Download from Zend.
If you don&#8217;t like the way the folders are represented in the PHP Explorer View you can change this by clicking on the little triangle pointing down on the upper right corner of the Package Explorer, then go to Package Presentation and select &#8220;Hierarchical&#8221;.
enjoy!
]]></description>
			<content:encoded><![CDATA[<p><a title="Eclipse PDT 2.0 All-In-One (BETA) download" href="http://downloads.zend.com/pdt/all-in-one/">All-In-One Download</a> from Zend.</p>
<p>If you don&#8217;t like the way the folders are represented in the <em>PHP Explorer View</em> you can change this by clicking on the little triangle pointing down on the upper right corner of the <em>Package Explorer</em>, then go to <em>Package Presentation</em> and select <em>&#8220;Hierarchical&#8221;</em>.</p>
<p><strong>enjoy!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/11/15/eclipse-pdt-20-all-in-one-beta-available/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend_Dojo_Form and Form Validation on the Client Side</title>
		<link>http://peacocksuit.com/blog/2008/11/10/zend_dojo_form-and-form-validation-on-the-client-side/</link>
		<comments>http://peacocksuit.com/blog/2008/11/10/zend_dojo_form-and-form-validation-on-the-client-side/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 03:00:12 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend_Dojo_Form]]></category>

		<category><![CDATA[Zend Framework]]></category>

		<category><![CDATA[Zend_View_Helper]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=107</guid>
		<description><![CDATA[One thing those of you who have been using Zend_Dojo_Form might have noticed is that dojo enabled forms don&#8217;t show validation warnings when submitted i.e. when the submit button is clicked. This can be quite confusing for the end user. 
So, how do we get our dojo enabled forms to validate when submitted? 


Matthew Weier [...]]]></description>
			<content:encoded><![CDATA[<p>One thing those of you who have been using Zend_Dojo_Form might have noticed is that dojo enabled forms don&#8217;t show validation warnings when submitted i.e. when the submit button is clicked. This can be quite confusing for the end user. </p>
<p><strong>So, how do we get our dojo enabled forms to validate when submitted?</strong> </p>
<p><a href="http://peacocksuit.com/blog/wp-content/uploads/2008/11/zend_dojo_form.gif"><img src="http://peacocksuit.com/blog/wp-content/uploads/2008/11/zend_dojo_form.gif" alt="" title="zend_dojo_form" width="500" height="132" class="aligncenter size-full wp-image-112" /></a></p>
<p><a href="http://peacocksuit.com/blog/wp-content/uploads/2008/11/zend_dojo_form_validation.gif"><img src="http://peacocksuit.com/blog/wp-content/uploads/2008/11/zend_dojo_form_validation.gif" alt="" title="zend_dojo_form" width="500" height="132" class="aligncenter size-full wp-image-111" /></a></p>
<p><a href="http://weierophinney.net/matthew/">Matthew Weier O&#8217;Phinney</a> explains <a href="http://www.nabble.com/Zend_Dojo-Email-validation%2C-checkbox-and-Submit-dojo-form-question--please--tt19441003.html#a19448055">on nabble</a> that:</p>
<blockquote><p>
You need to bind to the onSubmit event of your form, and validate in<br />
your callback. One way to do this is as follows, from your view script:
</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #339933;">&lt;</span> ? <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">javascriptCaptureStart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">function</span> validateForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> dijit<span style="color: #339933;">.</span>byId<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;formid&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>form<span style="color: #339933;">.</span>validate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        alert<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Invalid form&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;</span> ? <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">javascriptCaptureEnd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span> ? <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">onLoadCaptureStart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    dojo<span style="color: #339933;">.</span>connect<span style="color: #009900;">&#40;</span>dijit<span style="color: #339933;">.</span>byId<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/formid&gt;&lt;formid&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;onSubmit&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;validateForm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;</span> ? <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">onLoadCaptureEnd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>formid<span style="color: #339933;">&gt;</span></pre></div></div>

<blockquote><p>
What the above does is connect the onSubmit event to the form, which<br />
then executes the validateForm() function; if this returns false,<br />
submission is halted, and, in this case, an alert raised. You could also<br />
popup a dialog box or some other notification.
</p></blockquote>
<p>The above snippet of code Matthew describes doesn&#8217;t quite work. An Issue has been created for it here <a href="http://framework.zend.com/issues/browse/ZF-4587">http://framework.zend.com/issues/browse/ZF-4587</a>, but there is a work around, we can use headScript()->capture instead. </p>
<h3>Let&#8217;s look at how to apply this as a view helper.</h3>
<p><strong>The view helper:</strong></p>
<p>library/My/View/Helper/ValidateDojoForm.php</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">class</span> My_View_Helper_ValidateDojoForm <span style="color: #000000; font-weight: bold;">extends</span> Zend_View_Helper_Abstract
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000033;">$view</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setView<span style="color: #009900;">&#40;</span>Zend_View_Interface <span style="color: #000033;">$view</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$view</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/**
     * Validate dojo enabled form onSubmit.
     *
     * @param  string $formId
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ValidateDojoForm<span style="color: #009900;">&#40;</span><span style="color: #000033;">$formId</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headScript</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">captureStart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        <span style="color: #000000; font-weight: bold;">function</span> validateForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> dijit<span style="color: #339933;">.</span>byId<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt; ?php echo $formId; ?&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>form<span style="color: #339933;">.</span>validate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        dojo<span style="color: #339933;">.</span>addOnLoad<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            dojo<span style="color: #339933;">.</span>connect<span style="color: #009900;">&#40;</span>dijit<span style="color: #339933;">.</span>byId<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt; ?php echo $formId; ?&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;onSubmit&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;validateForm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #339933;">&lt;</span> ?php <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headScript</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">captureEnd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is very simple view helper. All you need to do is call validateDojoForm in your view script passing in the id of the form you want to be validated on submission as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validateDojoForm</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'formId'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Helper paths need set up, one way of doing this is in our bootstrap as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #666666; font-style: italic;">/**
 * Initialize view and layouts
 */</span>
<span style="color: #000033;">$layout</span> <span style="color: #339933;">=</span> Zend_Layout<span style="color: #339933;">::</span><span style="color: #004000;">startMvc</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/path/to/layouts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$view</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$layout</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addHelperPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'My/View/Helper/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'My_View_Helper'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addHelperPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Zend/Dojo/View/Helper/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Zend_Dojo_View_Helper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>More information on <a href="http://framework.zend.com/manual/en/zend.view.helpers.html">view helpers</a> and <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.paths">helper paths</a>.</p>
<p><strong>What about a custom class that does all the work for us?</strong></p>
<h3>A Custom Zend Dojo Form Class</h3>
<p>library/My/Dojo/Form.php</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">class</span> My_Dojo_Form <span style="color: #000000; font-weight: bold;">extends</span> Zend_Dojo_Form
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">/**
     * Set form name
     *
     * @param  string $name
     * @return Zend_Form
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setName<span style="color: #009900;">&#40;</span><span style="color: #000033;">$name</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validateDojoForm</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000033;">$this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>All this does is call our validateDojoForm helper and pass it the id of the form we create. Now we create all our Dojo forms by extending our custom class:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">class</span> Form_Name <span style="color: #000000; font-weight: bold;">extends</span> My_Dojo_Form
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'myForm'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ValidationTextBox'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'validators'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'StringLength'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'label'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Name'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'required'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'invalidMessage'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Please type your name.'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'trim'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SubmitButton'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'submitButton'</span><span style="color: #339933;">,</span>
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">'required'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'ignore'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'label'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Save'</span>
            <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Be sure to call setName() when creating your form. This will call our validateDojoForm helper and pass it the id of the form we create and thus capturing the neccessary javascript to validate our form when it&#8217;s submitted.</p>
<p><strong>enjoy!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/11/10/zend_dojo_form-and-form-validation-on-the-client-side/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse Keyboard Shortcuts</title>
		<link>http://peacocksuit.com/blog/2008/09/11/eclipse-keyboard-shortcuts/</link>
		<comments>http://peacocksuit.com/blog/2008/09/11/eclipse-keyboard-shortcuts/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 19:33:28 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Eclipse PDT]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=102</guid>
		<description><![CDATA[Eclipse keyboard shortcuts and some on PDT from Reinhold Weber, enjoy.
&#8220;There are developers who, no matter how much experience they have swear on using notepad for all their projects. If you read these lines now - congratulations, you are not one of those. No matter how fast you can code and how intelligent you are, [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Eclipse Keyboard Shortcuts" href="http://eclipse-tools.sourceforge.net/shortcuts.html"><strong>Eclipse keyboard shortcuts</strong></a> and some on PDT from <a title="Improving your workflow with Eclipse PDT  - Reinhold Weber" href="http://reinholdweber.com/?p=12">Reinhold Weber</a>, enjoy.</p>
<blockquote><p>&#8220;There are developers who, no matter how much experience they have swear on using notepad for all their projects. If you read these lines now - congratulations, you are not one of those. No matter how fast you can code and how intelligent you are, nothing can compensate for an educated use of a feature-rich IDE, no matter what language is your drug of choice.&#8221; - <a title="Improving your workflow with Eclipse PDT - Reinhold Weber" href="http://reinholdweber.com/?p=12">Improving your workflow with Eclipse PDT, Reinhold Weber</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/09/11/eclipse-keyboard-shortcuts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend framework: Logging Database Queries to FireBug</title>
		<link>http://peacocksuit.com/blog/2008/09/02/zend-framework-logging-database-queries-to-firebug/</link>
		<comments>http://peacocksuit.com/blog/2008/09/02/zend-framework-logging-database-queries-to-firebug/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 23:34:32 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend Framework]]></category>

		<category><![CDATA[Zend_Db_Profiler_Firebug]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=93</guid>
		<description><![CDATA[Logging database queries to FireBug is sinfully simple with the new component Zend_Db_Profiler_Firebug in ZF 1.6, now available, you can download it here Zend Framework Download Page.
Requirements:

Firefox Browser ideally version 3 but version 2 is also supported.
Firebug Firefox Extension.
FirePHP Firefox Extension.

More information on requirements at the Zend Framework Documentation -  Profiling with Firebug
Let&#8217;s look at [...]]]></description>
			<content:encoded><![CDATA[<p>Logging database queries to FireBug is sinfully simple with the new component Zend_Db_Profiler_Firebug in ZF 1.6, now available, you can download it here <a title="Zend Framework Download Page" href="http://framework.zend.com/download/current/">Zend Framework Download Page</a>.</p>
<p>Requirements:</p>
<ol>
<li>Firefox Browser ideally version 3 but version 2 is also supported.</li>
<li>Firebug Firefox Extension.</li>
<li>FirePHP Firefox Extension.</li>
</ol>
<p>More information on requirements at the <a title="Zend Framework Documentation - Profiling with Firebug " href="http://framework.zend.com/manual/en/zend.db.profiler.html#zend.db.profiler.profilers.firebug">Zend Framework Documentation -  Profiling with Firebug</a></p>
<p>Let&#8217;s look at some examples.</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">// Instatiate the database</span>
<span style="color: #000033;">$db</span> <span style="color: #339933;">=</span> Zend_Db<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pdo_Mysql'</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'dbname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'zf_feature_testing'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user123'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pass123'</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Instantiate the profiler in your bootstrap file </span>
<span style="color: #000033;">$profiler</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Db_Profiler_Firebug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'All Database Queries:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Enable it</span>
<span style="color: #000033;">$profiler</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Attach the profiler to your db adapter </span>
<span style="color: #000033;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProfiler</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$profiler</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Run your queries</span>
<span style="color: #000033;">$result1</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM zf_test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$result2</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM zf_test where id = ?'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Alternatively you can add the profiler parameters to the Zend_Db factory.</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">// Instatiate the database, passing in the profiler parameters.</span>
<span style="color: #000033;">$db</span> <span style="color: #339933;">=</span> Zend_Db<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pdo_Mysql'</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'dbname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'zf_feature_testing'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user123'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pass123'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'profiler'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'enabled'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Zend_Db_Profiler_Firebug'</span>
        <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Or from an .ini file using Zend_Config_Ini</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000033;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config_Ini<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../application/config.ini'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'development'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$db</span> <span style="color: #339933;">=</span> Zend_Db<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">database</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>config.ini</p>

<div class="wp_syntax"><div class="code"><pre class="ini"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>development<span style="">&#93;</span></span>
database.adapter                    <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> pdo_mysql</span>
database.params.host                <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> localhost</span>
database.params.username            <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> user123</span>
database.params.password            <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> pass123</span>
database.params.dbname              <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> zf_feature_testing</span>
database.params.profiler.enabled    <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> true</span>
database.params.profiler.class      <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Zend_Db_Profiler_Firebug</span></pre></div></div>

<p><strong>Show me my profiling data?</strong></p>
<p>Open FireBug, you will see a link under console.</p>
<p><img alt="Profiling with FireBug" src="http://peacocksuit.com/images/profiling-w-firebug-01.gif" title="Profiling with FireBug" width="469" height="112" /></p>
<p>Click it open and it will list all the queries that were run.</p>
<p><img alt="Profiling with FireBug" src="http://peacocksuit.com/images/profiling-w-firebug-02.gif" title="Profiling with FireBug" width="571" height="431" /></p>
<p><strong>Enjoy!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/09/02/zend-framework-logging-database-queries-to-firebug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What&#8217;s new in Zend framework 1.6</title>
		<link>http://peacocksuit.com/blog/2008/09/02/whats-new-in-zend-framework-16/</link>
		<comments>http://peacocksuit.com/blog/2008/09/02/whats-new-in-zend-framework-16/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 10:37:01 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=91</guid>
		<description><![CDATA[Wildfire, captcha and dojo integration are just some of the highlights.
&#8220;Watch this presentation to hear the entire Zend Framework team talk about what to expect from Zend Framework 1.6, soon to be released.
Presented by Wil Sinclair, Development Manager, Matthew Weier O’phinney, Software Architect, Alexander Veremyev, Software Engineer and Ralph Schindler, Software Engineer. - Zend&#8220;
Click here [...]]]></description>
			<content:encoded><![CDATA[<p>Wildfire, captcha and dojo integration are just some of the highlights.</p>
<blockquote><p>&#8220;Watch this presentation to hear the entire Zend Framework team talk about what to expect from Zend Framework 1.6, soon to be released.<br />
Presented by Wil Sinclair, Development Manager, Matthew Weier O’phinney, Software Architect, Alexander Veremyev, Software Engineer and Ralph Schindler, Software Engineer. - <a title="Zend framework Webinars" href="http://www.zend.com/en/resources/webinars/framework">Zend</a>&#8220;</p></blockquote>
<p><a title="What's new in Zend framework 1.6 - Presentation Slides" href="http://static.zend.com/topics/webinar-zf16.pdf">Click here to download the presentation slides</a></p>
<p><a title="What's new in Zend framework 1.6 - Webinar" href="http://www.zend.com/en/resources/webinars/framework">Click here to watch the recorded Webinar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/09/02/whats-new-in-zend-framework-16/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend_Acl and MVC</title>
		<link>http://peacocksuit.com/blog/2008/09/01/zend_acl-and-mvc/</link>
		<comments>http://peacocksuit.com/blog/2008/09/01/zend_acl-and-mvc/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 14:19:36 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend Framework]]></category>

		<category><![CDATA[Zend_Acl]]></category>

		<category><![CDATA[Zend_Auth]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=67</guid>
		<description><![CDATA[Quickstart Screencasts
Zend_Auth
Zend_Acl
Zend Developer Zone Tutorials
Zend_Acl and MVC Integration Part I (Basic Use)
Zend_Acl and MVC Integration Part II (Advanced Use)
Matthew Weier O&#8217;Phinney Tutorial
Login and Authentication with Zend Framework
&#8220;Zend_Auth does a lot of behind the scenes work to make persisting an identity in the session trivial. Combine it with Zend_Form, and you have a very easy to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Quickstart Screencasts</strong></p>
<p><a title="roetgers.org - Zend_Auth Quickstart" href="http://www.roetgers.org/screencast-index/zend_auth-quickstart/"><code>Zend_Auth</code></a><br />
<a title="roetgers.org - Zend_Acl Quickstart" href="http://www.roetgers.org/screencast-index/zend_acl-quickstart/"><code>Zend_Acl</code></a></p>
<p><strong>Zend Developer Zone Tutorials</strong></p>
<p><a title="Zend Developer Zone - Zend_Acl and MVC Integration Part I (Basic Use)" href="http://devzone.zend.com/article/3509-Zend_Acl-and-MVC-Integration-Part-I-Bas"><code>Zend_Acl</code> and MVC Integration Part I (Basic Use)</a><br />
<a title="Zend Developer Zone - Zend_Acl and MVC Integration Part II (Advanced Use)" href="http://devzone.zend.com/article/3510-Zend_Acl-and-MVC-Integration-Part-II-Ad"><code>Zend_Acl</code> and MVC Integration Part II (Advanced Use)</a></p>
<p><strong>Matthew Weier O&#8217;Phinney Tutorial</strong></p>
<p><a title="Matthew Weier O'Phinney - Login and Authentication with Zend framework" href="http://weierophinney.net/matthew/archives/165-Login-and-Authentication-with-Zend-Framework.html">Login and Authentication with Zend Framework</a></p>
<blockquote><p>&#8220;<code>Zend_Auth</code> does a lot of behind the scenes work to make persisting an identity in the session trivial. Combine it with <code>Zend_Form</code>, and you have a very easy to implement solution for retrieving and validating credentials; add standard hooks in the     <code>Zend_Controller</code> component for filtering actions prior to dispatch, and you can restrict access to applications easily based on authentication status.&#8221;</p></blockquote>
<p><strong>Zend</strong></p>
<p><a title="Zend framework Webinars" href="http://www.zend.com/en/resources/webinars/framework">Zend framework Webinars</a></p>
<blockquote><p>&#8220;<code>Zend_Auth</code> helps web developers to implement authentication for their applications by providing a simple API and various adapters for popular authentication backends, such as LDAP, InfoCard, and OpenID. In this webinar, we implemented the authentication process using <code>Zend_Auth</code> and demonstrate its flexibility and extensibility for custom functionality.&#8221;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/09/01/zend_acl-and-mvc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Populate a Zend_Form select with database returned data</title>
		<link>http://peacocksuit.com/blog/2008/08/30/populate-a-zend_form-select-with-mysql-returned-data/</link>
		<comments>http://peacocksuit.com/blog/2008/08/30/populate-a-zend_form-select-with-mysql-returned-data/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 11:33:15 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend_Form_Element_Select]]></category>

		<category><![CDATA[Zend Framework]]></category>

		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=46</guid>
		<description><![CDATA[The code speaks for itself:

$category = new Zend_Form_Element_Select&#40;'category'&#41;;
$category-&#62;setLabel&#40;'Category'&#41;
         -&#62;setRequired&#40;true&#41;;
&#160;
$table = new Category&#40;&#41;;
foreach &#40;$table-&#62;fetchAll&#40;&#41; as $c&#41; &#123;
    $category-&#62;addMultiOption&#40;$c-&#62;id, $c-&#62;name&#41;;
&#125;

&#8220;By default, this element registers an InArray validator which validates against the array keys of registered options. You can disable this behavior by either calling setRegisterInArrayValidator(false), or [...]]]></description>
			<content:encoded><![CDATA[<p>The code speaks for itself:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000033;">$category</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form_Element_Select<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'category'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Category'</span><span style="color: #009900;">&#41;</span>
         <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$table</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000033;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addMultiOption</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #000033;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<blockquote><p>&#8220;By default, this element registers an InArray validator which validates against the array keys of registered options. You can disable this behavior by either calling setRegisterInArrayValidator(false), or by passing a false value to the registerInArrayValidator  configuration key.&#8221;<br />
<cite><a title="Zend framework Reference - Zend_Form_Element_Select" href="http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.select" target="_blank">Zend framework Manual.</a></cite></p></blockquote>
<p>If you want to order the way the categories are displayed you could do this in your model.</p>
<p>The database table:</p>

<div class="wp_syntax"><div class="code"><pre class="sql"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`category`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`name`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span> collate utf8_unicode_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`order`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8 COLLATE<span style="color: #66cc66;">=</span>utf8_unicode_ci <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">4</span> ;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`category`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`name`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`order`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Category Three Order 3rd'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Category One Order 1st'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Category Two Order 2nd'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The model:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">/** Zend_Db_Table_Abstract */</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Zend/Db/Table/Abstract.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Category <span style="color: #000000; font-weight: bold;">extends</span> Zend_Db_Table_Abstract
<span style="color: #009900;">&#123;</span>
    protected <span style="color: #000033;">$_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'category'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> findForSelect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #000033;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #000033;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'order'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #b1b100;">return</span> <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$select</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Populate the select:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000033;">$category</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form_Element_Select<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'category'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Category'</span><span style="color: #009900;">&#41;</span>
         <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$table</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findForSelect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000033;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addMultiOption</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #000033;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/08/30/populate-a-zend_form-select-with-mysql-returned-data/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Good OOP Practice / Zend framework</title>
		<link>http://peacocksuit.com/blog/2008/08/28/good-oop-practice-zend-framework/</link>
		<comments>http://peacocksuit.com/blog/2008/08/28/good-oop-practice-zend-framework/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 08:42:03 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=33</guid>
		<description><![CDATA[An interesting post on nabble yesterday by Matthew Weier O&#8217;Phinney on the difference between:

if &#40;$this-&#62;getRequest&#40;&#41;-&#62;isPost&#40;&#41;&#41; &#123;
     // process
&#125;
&#160;
if &#40;$this-&#62;_request-&#62;isPost&#40;&#41;&#41; &#123;
     // process
&#125;
&#160;
if &#40;$_SERVER&#91;'REQUEST_METHOD'&#93; == 'POST'&#41; &#123;
    // process
&#125;

Sometimes, he explains
“the obvious and simple solutions simply are not portable, or would circumvent custom logic the [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting <a title="Nabble - Zend framework - Good OOP Practice" href="http://www.nabble.com/%24this-%3EgetRequest()-%3EisPost()-vs.-(%24_SERVER-%27REQUEST_METHOD%27--%3D%3D-%27POST%27)-to19185079.html">post</a> on nabble yesterday by Matthew Weier O&#8217;Phinney on the difference between:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isPost</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// process</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span>_request<span style="color: #339933;">-&gt;</span><span style="color: #004000;">isPost</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// process</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// process</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Sometimes, he explains</p>
<blockquote><p>“the obvious and simple solutions simply are not portable, or would circumvent custom logic the developer may need to utilize.”</p></blockquote>
<p>You could use $this->_request</p>
<blockquote><p>“However, if you ever modify getRequest() in your class or in a custom base controller class, then you may be accessing the wrong property or overriding necessary business logic. For this reason, we recommend using getRequest() to grab the request object.”</p></blockquote>
<blockquote><p>“Next, using isPost() is more portable than using $_SERVER['REQUEST_METHOD']. The reasons are that your web server may or may not populate this environment variable, and for testing. With testing, we allow you to specifically set the request method &#8212; $_SERVER is never modified in this case. This gives you the ability to test your applications without needing a web server involved.”</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/08/28/good-oop-practice-zend-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Web Development Tools</title>
		<link>http://peacocksuit.com/blog/2008/08/02/development-tools/</link>
		<comments>http://peacocksuit.com/blog/2008/08/02/development-tools/#comments</comments>
		<pubDate>Sat, 02 Aug 2008 20:34:12 +0000</pubDate>
		<dc:creator>Gerard Roche</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[Eclipse PDT]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Xampp]]></category>

		<guid isPermaLink="false">http://peacocksuit.com/blog/?p=10</guid>
		<description><![CDATA[Xampp
Xampp is a one stop shop for an all in one package of everything you need to get started with your local development environment.
Download and install Xampp
Eclipse PDT
Eclipse is free.
Zend has an all in one package with the Zend Debugger plugin available for download.
Download Eclipse PDT from zend.com and install
Firefox
Download Firefox and install

Recommended Addons

Web Developer [...]]]></description>
			<content:encoded><![CDATA[<h2>Xampp</h2>
<p>Xampp is a one stop shop for an all in one package of everything you need to get started with your local development environment.</p>
<p><a title="Xampp" href="http://apachefriends.org" target="_blank">Download and install Xampp</a></p>
<h2>Eclipse PDT</h2>
<p>Eclipse is free.</p>
<p>Zend has an all in one package with the Zend Debugger plugin available for download.</p>
<p><a title="Eclipse PDT" href="http://www.zend.com/pdt" target="_blank">Download Eclipse PDT from zend.com and install</a></p>
<h2>Firefox</h2>
<p><a title="Firefox" href="http://www.mozilla.com/en-US/firefox/" target="_blank">Download Firefox and install</a></p>
<ul>
<li>Recommended Addons
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer Toolbar</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/249">Html Validator</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1865">AdBlock PLus</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/5369">YSlow</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/5648">Fireshot</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://peacocksuit.com/blog/2008/08/02/development-tools/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
