<?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>The Zend Framework in Practice &#187; ZendX_JQuery</title>
	<atom:link href="http://zf.gm-ram.com/topics/zendx_jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://zf.gm-ram.com</link>
	<description>Developing Web Applications with the Zend Framework</description>
	<lastBuildDate>Mon, 02 Jan 2012 10:20:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using CKEditor with the Zend Framework</title>
		<link>http://zf.gm-ram.com/posts/using-ckeditor-with-the-zend-framework/</link>
		<comments>http://zf.gm-ram.com/posts/using-ckeditor-with-the-zend-framework/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 16:39:24 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Form]]></category>
		<category><![CDATA[Zend_Layout]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=913</guid>
		<description><![CDATA[At the moment I am working on create a system that allows non-technical users to easily add and edit product pages on one of the website I have developed. Until now, adding or modifying a page has required modifications to the database and/or a PHP script file, along with uploading any new resources, such as [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment I am working on create a system that allows non-technical users to easily add and edit product pages on one of the website I have developed. Until now, adding or modifying a page has required modifications to the database and/or a PHP script file, along with uploading any new resources, such as images or documents. This has meant in practice that either I or one of the more technically minded people at the client has tended to do these changes. The idea of the new system is that it will allow anyone to add/edit product pages.<span id="more-913"></span></p>
<p>Each product page has a standard layout. The page divides into two vertical sections; the top vertical section is divided into two columns. The left column contains the main text describing the products on that page; the right column contains supplementary images and download links. The bottom vertical section contains a jQuery UI tab control, with one tab for each section of products being offered for sale on that page.</p>
<p>I needed to allow the user to edit the HTML used in the top left section. However, I didn&#8217;t want the user to have to write raw HTML, but rather to use a WYSIWYG editor. I identified the Open Source JavaScript editor CKEditor as a suitable candidate.</p>
<p>The process of integrating this editor with the existing Zend Framework application proved to be pretty simple:</p>
<ol>
<li>Download the latest version of the editor from <a href="http://ckeditor.com/" title="CKEditor website">the CKEditor website</a>.</li>
<li>Having unpacked the download, I uploaded the CKEditor directory (<em>ckeditor</em>) under the public web root (<em>htdocs</em>).</li>
<li>The layout script already contained the following in the page head, which forced the appropriate tags to load and enable jQuery to be added:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>I added the following at the top of the view scripts that were going to make use of the editor. Note that the ID of the form field that was going to be enhanced by the editor was <strong>description</strong>.

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// CKEditor</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJavascriptFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/ckeditor/ckeditor.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJavascriptFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/ckeditor/adapters/jquery.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$('#description').ckeditor();&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>I created a class to handle the form that used the editor. The class was named <strong>Application_Form_ProductPage</strong> and ultimately derived from Zend_Form via Application_Form_Abstract.</li>
<li>The init method of the class contained the following code to add the textarea that was enhanced going to be the editor:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElement</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'textarea'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'label'</span>		<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Product Description'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'decorators'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldDecorators</span><span style="color: #009900;">&#40;</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>

</li>
</ol>
<p>As a result of the able, the textarea was transformed into a fully-blown WYSIWYG editor. The raw HTML was passed behind the scenes, and was added to/retrieved from the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/using-ckeditor-with-the-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Login Page: The login/index view script</title>
		<link>http://zf.gm-ram.com/posts/the-login-page-the-loginindex-view-script/</link>
		<comments>http://zf.gm-ram.com/posts/the-login-page-the-loginindex-view-script/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 08:00:44 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Form]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=781</guid>
		<description><![CDATA[The previous post discussed the implementation of the Login Controller; in this post, we will look at the implementation of the view script associated with the login/index action. The view script is used in conjunction with a layout, which we will not discuss here. The only thing we will mention here is that the layout [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://zf.gm-ram.com/posts/the-login-controller/">previous post</a> discussed the implementation of the Login Controller; in this post, we will look at the implementation of the view script associated with the login/index action.<span id="more-781"></span></p>
<p>The view script is used in conjunction with a layout, which we will not discuss here. The only thing we will mention here is that the layout script contains the following code in the head section:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// jQuery</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Links</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

<p>This uses the jQuery and headLink view helpers to:</p>
<ul>
<li>Render the appropriate tags for including the core jQuery files</li>
<li>Render the link tags used to include the stylesheet.</li>
</ul>
<p>The latter point is of relevance, as the first lines of the view script are:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Append the login page stylesheet</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/login.css'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The stylesheet file appended here needs to be rendered, and the <strong>echo $this->headLink()</strong> statement in the layout script does just that.</p>
<p>The styles in the file are as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#login_title</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login_error</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login_form</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login_form</span> dl
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#d3d3d3</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login_form</span> dt
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">120px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login_form</span> dd
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">240px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The form is rendered as a definition list (dl), so the main task of the above styling is to ensure that the label (dt) and input control (dd) are on the same line. This rendering is the default behaviour of Zend_Form.</p>
<p>The jQuery include is necessary, as the script makes use of it to give focus the appropriate field in the form.</p>
<p>The script first enables jQuery, then includes a general purpose JavaScript file, used to give focus to fields on a form.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Add the form JavaScript file</span>
ZendX_JQuery<span style="color: #339933;">::</span><span style="color: #004000;">enableView</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJavascriptFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/form.js'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The <em>form.js</em> JavaScript file contains the following script:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> Form <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	Form.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">FirstFieldFocus</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>form_id<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span> <span style="color: #339933;">+</span> form_id <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; :input:visible:enabled:first&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</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: #339933;">;</span>
&nbsp;
	Form.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">ErrorFieldFocus</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>field_id<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span> <span style="color: #339933;">+</span> field_id<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</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: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> theForm <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The above provides two basic functions:</p>
<ul>
<li>Select the first field on a form</li>
<li>Select a specific field on a form</li>
</ul>
<p>The first requires an elaborate jQuery selector, which detemines the first input field on the form which is visible and enabled.</p>
<p>The script now moves on to render the page title:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Display the page title</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;h3 id=&quot;login_title&quot;&gt;Login&lt;/h3&gt;'</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

<p>Finally, the script renders the form and any error messages. In addition to the form itself, the script also create the appropriate JavaScript to invoke the functions defined in <em>form.js</em> in order to either select the error field, if there was an error when the form was submitted, or the first field of the form, if the form has not yet been submitted.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Display any error messages and set focus to the appropriate form field</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorMessage</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;div id=&quot;login_error&quot; class=&quot;error&quot;&gt;%s&lt;/div&gt;'</span> <span style="color: #339933;">.</span> 
PHP_EOL<span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorMessage</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'theForm.ErrorFieldFocus(&quot;%s&quot;);'</span><span style="color: #339933;">,</span> 
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorField</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'theForm.FirstFieldFocus(&quot;%s&quot;);'</span><span style="color: #339933;">,</span> 
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttrib</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Render login form</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAction</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/login'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">;</span></pre></div></div>

<p>Note the use of <strong>$this->jQuery()->addOnload()</strong>. The script is not rendered directly to the page in the view script, but rather in the layout script, by the <strong>echo $this->jQuery(</strong>) statement. It is wrapped inside a jQuery ready event, so that it is only executed when the whole page is loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-login-page-the-loginindex-view-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Lightbox to the GM-RAM Website</title>
		<link>http://zf.gm-ram.com/posts/adding-lightbox-to-the-gm-ram-website/</link>
		<comments>http://zf.gm-ram.com/posts/adding-lightbox-to-the-gm-ram-website/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 11:39:59 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Layout]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=729</guid>
		<description><![CDATA[To quote the Lightbox 2 website: Lightbox is a simple, unobtrusive script used to overlay images on the current page. It&#8217;s a snap to setup and works on all modern browsers. I decided to add the script to the GM-RAM website in order to allow visitors to view full-sized versions of the screen shots there [...]]]></description>
			<content:encoded><![CDATA[<p>To quote the <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2 website</a>:</p>
<blockquote><p>Lightbox is a simple, unobtrusive script used to overlay images on the current page. It&#8217;s a snap to setup and works on all modern browsers.</p></blockquote>
<p>I decided to add the script to the GM-RAM website in order to allow visitors to view full-sized versions of the screen shots there without having to navigate to a separate page.<span id="more-729"></span></p>
<p>I downloaded the Lightbox JavaScript, style sheet and images that need to be placed in the publically-accessible part of the website. The JavaScript files were stored under <em>/js/lightbox/</em>, the style sheet at <em>/css/lightbox.css</em> and the images under <em>/img/lightbox</em>.</p>
<p>The first challenge arose from the fact that the site already uses jQuery, while Lightbox is based on <a href="http://www.prototypejs.org/">Prototype</a> and <a href="http://script.aculo.us/">Scriptaculous</a>. As both use the dollar ($) symbol, it was necessary to put jQuery into no conflict mode. Fortunately, as I was using ZendX_JQuery, there is a built-in mechanism for handling this.</p>
<p>In order to make sure that you use the correct jQuery &#8220;handler&#8221; character ($ or something else), you should dynamically determine what this is. An example of this is from the view handler I wrote to create the JavaScript used to load the results of an AJAX request into a block on the page:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Application_View_Helper_LoadScript <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: #000000; font-weight: bold;">function</span> loadScript<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$jqHandler</span> <span style="color: #339933;">=</span> ZendX_JQuery_View_Helper_JQuery<span style="color: #339933;">::</span><span style="color: #004000;">getJQueryHandler</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$jqHandler</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'(&quot;#%s&quot;).html(&quot;Loading...&quot;); '</span> <span style="color: #339933;">.</span> 
      <span style="color: #000088;">$jqHandler</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'(&quot;#%s&quot;).load(&quot;%s&quot;);'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</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>Lightbox works unobtrusively by looking for links with the <strong>rel</strong> attribute set to either just <strong>lightbox</strong> or <strong>lightbox[<em>group-name</em>]</strong>, where <em>group-name</em> is set to the same value for a series of images that the user should be able to view by navigating forwards and backwards. The links are wrapped around an image.</p>
<p>I changed the attributes of the images in line with this on the relevant pages. I then created a common script to be included in all the pages, which would set up Lightbox on them. The script is called <em>lightbox.phtml</em> and is located in <em>/application/views/scripts</em>. It is added to the pages&#8217; view scripts by the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lightbox.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The <em>lightbox.phtml</em> script starts by activating jQuery no conflict mode; as noted before, this is because Lightbox uses Prototype and Scriptaculous.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">ZendX_JQuery_View_Helper_JQuery<span style="color: #339933;">::</span><span style="color: #004000;">enableNoConflictMode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The script then adds the Lightbox JavaScript files. It is possible to do this here, as the view script is rendered <strong>before</strong> the layout, and therefore when <strong>echo $this->headScript()</strong> is used in the layout script to finally generate the list of script tags in the header, these are included in the output generated.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</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;">appendFile</span><span style="color: #009900;">&#40;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/lightbox/prototype.js'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</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;">appendFile</span><span style="color: #009900;">&#40;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/lightbox/scriptaculous.js?load=effects,builder'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</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;">appendFile</span><span style="color: #009900;">&#40;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/lightbox/lightbox.js'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Because the implementation of Lightbox assumes locations for its images that are not always correct, we need to add some JavaScript to change them. The script we generate is added using the same mechanism as for the basic script files, although here we are using inline script that we have generated.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</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;">appendScript</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'LightboxOptions.fileLoadingImage = &quot;'</span> <span style="color: #339933;">.</span> 
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/img/lightbox/loading.gif'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</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;">appendScript</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'LightboxOptions.fileBottomNavCloseImage = &quot;'</span> <span style="color: #339933;">.</span> 
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/img/lightbox/closelabel.gif'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then we add the Lightbox style sheet using a similar mechanism, this time using the <strong>headLink</strong> helper. This helper is called via <strong>echo $this->headLink()</strong> in the layout script, which renders this link along with the others added there.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/lightbox.css'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Finally, we need to override some of the styling, which relates to the location of images. We used the <strong>headStyle</strong> helper for this; as with the <strong>headScript</strong> and <strong>headLink </strong> helpers, this relies on the layout script making a call to the helper, this time via <strong>echo $this->headStyle()</strong>. Note that this call to <strong>headStyle</strong> should come after the call to <strong>headLink</strong> in the header to ensure the overriding of the styling.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">$this-&gt;headStyle()-&gt;captureStart();
?&gt;
#prevLink:hover, #prevLink:visited:hover
{
  background: url(<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/img/lightbox/prevlabel.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>) 
left 15% no-repeat;
}
&nbsp;
#nextLink:hover, #nextLink:visited:hover
{
  background: url(<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/img/lightbox/nextlabel.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>) 
right 15% no-repeat;
}
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headStyle</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></pre></div></div>

<p>Note the use of the <strong>captureStart</strong> and <strong>captureEnd</strong> methods to allow the CSS to be rendered inline.</p>
<p>Regarding the calls to <strong>headScript</strong>, <strong>headLink</strong> and <strong>headStyle</strong>, the relevant section of the layout script is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Scripts</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</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;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Links</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prependStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/default.css'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'shortcut icon'</span><span style="color: #339933;">,</span> 
  <span style="color: #0000ff;">'href'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">baseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/img/favicon.ico'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-icon'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Styles</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headStyle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

<p>Now the Lightbox effect should be applied to all the tagged images on the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/adding-lightbox-to-the-gm-ram-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Blogs Page: The index/blogs view script</title>
		<link>http://zf.gm-ram.com/posts/the-blogs-page-the-indexblogs-view-script/</link>
		<comments>http://zf.gm-ram.com/posts/the-blogs-page-the-indexblogs-view-script/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 12:36:09 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=568</guid>
		<description><![CDATA[As with the other pages, the view script for the blogs page makes use of jQuery UI tabs. The special feature of this page compared to the others is that the number of tabs is dependent on the number of blogs in the database. The script contains the following code: $this-&#62;tabPane&#40; 'tabs', $this-&#62;render&#40;'index/blogs/our-blogs.phtml'&#41;, array&#40;'title' =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>As with the other pages, the view script for the blogs page makes use of jQuery UI tabs. The special feature of this page compared to the others is that the number of tabs is dependent on the number of blogs in the database.<span id="more-568"></span></p>
<p>The script contains the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/blogs/our-blogs.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Our Blogs'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">blogs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">partial</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/blogs/blog-partial.phtml'</span><span style="color: #339933;">,</span>
      <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'href'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span>
      <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabContainer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tabs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The page makes use of the partial view helper to render the markup for each blog page&#8217;s tab. The partial helper takes two parameters; the first indicates the file containing the partial view script, the second the variable parameters used to fill out this script. The partial view script used here contains the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h1&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h1&gt;
&nbsp;
&lt;p&gt;
  &lt;strong&gt;URL: &lt;/strong&gt; 
    &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;nofollow&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
&lt;/p&gt;
&nbsp;
&lt;p&gt;
  &lt;strong&gt;Description:&lt;/strong&gt; 
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ajaxFeedDigest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

<p>The parameters passed to the partial view script are the blog name and description, its URL, and its ID. The last is passed to the AjaxFeedDigest view helper.</p>
<p>We shall look at the implementation of the AjaxFeedDigest view helper in the next post. It is used to render a list of the most recent five posts on the specified blog, using the blog&#8217;s feed to fetch the information. The decision to use an AJAX approach to rendering this list was because sometime it can take a little time to fetch this information. If the site had to wait for it before rendering the rest of the page, the user can often be faced with an unacceptable wait staring at a blank browser tab. However, if the rest of the page is rendered first, then the user can at least view that; the information for each blog feed can then be filled in as soon as it is available.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-blogs-page-the-indexblogs-view-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Contact Page: The View Script</title>
		<link>http://zf.gm-ram.com/posts/the-contact-page-the-view-script/</link>
		<comments>http://zf.gm-ram.com/posts/the-contact-page-the-view-script/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 18:26:30 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Form]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=448</guid>
		<description><![CDATA[As with the home page, the view script for the contact page makes use of jQuery UI tabs. See the post The Home Page for more information the ZendX_JQuery view helpers used here to generate the necessary markup and JavaScript. The script contains the following code: &#60;?php $this-&#62;tabPane&#40; 'tabs', $this-&#62;render&#40;'index/contact/contact-us.phtml'&#41;, array&#40;'title' =&#62; 'Contact Us'&#41; &#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>As with the home page, the view script for the contact page makes use of jQuery UI tabs. See the post <a href="/posts/the-home-page/">The Home Page</a> for more information the ZendX_JQuery view helpers used here to generate the necessary markup and JavaScript.<span id="more-448"></span></p>
<p>The script contains the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/contact/contact-us.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Contact Us'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabContainer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tabs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The contents of the tab are rendered by the <em>contact-us.phtml</em> script in the <em>contact</em> sub-directory. This starts by rendering the tab heading:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>h1<span style="color: #339933;">&gt;</span>Contact Us<span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Then it determines whether an error has occurred; if it has, the amount of information displayed depends on whether the site is deployed in a development environment:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorMessage</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENV <span style="color: #339933;">==</span> <span style="color: #0000ff;">'development'</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p class=&quot;error&quot;&gt;%s&lt;/p&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorMessage</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> 
PHP_EOL<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p class=&quot;error&quot;&gt;There was a problem sending 
your message; please phone us on %s, or try again later.
&lt;/p&gt;'</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">,</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">placeholder</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'phoneNumber'</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>If an error has not occurred, the script tests whether the <strong>message sent</strong> flag is set; if it has, it displays an appropriate message for the user:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sent</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;Thank you for contacting GM-RAM! We will attempt 
to respond to you as soon as possible.&lt;/p&gt;'</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If the message sent flag is not sent, the script will render the contact form instructions and the form itself; if the form has been submitted, but failed validation, any errors will be displayed here and the appropriate form selected.</p>
<p>The script starts with the instructions:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;Please fill in the following form and click on the 
&lt;strong&gt;Send&lt;/strong&gt; button.&lt;/p&gt;'</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

<p>Then it tests for a validation error and displays the error message:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</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;">// Display the error message</span>
    <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p class=&quot;error&quot;&gt;%s&lt;/p&gt;'</span> <span style="color: #339933;">.</span> 
PHP_EOL<span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It also selects the error field using jQuery:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Select the error field</span>
    <span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$(&quot;#%s&quot;).focus()'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Note that the script dynamically creates a jQuery selector which refers to the field id, e.g. <strong>$(&#8220;#name&#8221;)</strong> for the name field. Also note that it uses the ZendX_JQuery helper to add this code to the functions executed when the page has loaded; this makes sure that the field is selected properly.</p>
<p>If there is no error, a similar mechanism is used to select the first form field:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Select the first field</span>
    <span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'$(&quot;#%s :input:visible:enabled:first&quot;).focus()'</span><span style="color: #339933;">,</span> 
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttrib</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addOnload</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Note the special jQuery selection code applied to the form to select the first field; this doesn&#8217;t depend on the field ID staying the same (or indeed on the form ID staying the same, as the script fetches that dynamically).</p>
<p>Finally, the script sets the form action and renders it:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAction</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</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;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We have already looked at the implementation of the action handler. In my next post I shall look at the classes used to implement the form.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-contact-page-the-view-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The About Page</title>
		<link>http://zf.gm-ram.com/posts/the-about-page/</link>
		<comments>http://zf.gm-ram.com/posts/the-about-page/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 16:36:54 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Controller]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=428</guid>
		<description><![CDATA[The implementation of the about page is similar to that of the home page, as described in the post The Home Page. The about page is rendered by the about action handler of the index controller. The about action handler is an empty function: public function aboutAction&#40;&#41; &#123; &#160; &#125; The functionality is contained within [...]]]></description>
			<content:encoded><![CDATA[<p>The implementation of the about page is similar to that of the home page, as described in the post <a href="/posts/the-home-page/">The Home Page</a>.<span id="more-428"></span></p>
<p>The about page is rendered by the about action handler of the index controller.</p>
<p>The about action handler is an empty function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> aboutAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The functionality is contained within the view script:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/about/about-us.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'About Us'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/about/windows-development.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Windows Development'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/about/web-development.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Web Development'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabContainer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tabs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Like the home page, the about page makes use of jQuery UI tabs; the main difference is that there are three tabs on the page rather than one. See the post  <a href="/posts/the-home-page/">The Home Page</a> for more information the ZendX_JQuery view helpers used here to generate the necessary markup and JavaScript.</p>
<p>The contents of the tabs are in three files stored in the <em>about</em> sub-directory. The content of these scripts is not repeated here, as it should be obvious from the online version of the site. The only thing to note is that the first script makes use of the custom view helper described in the post <a href="/posts/the-navigation-link-view-helper/">The Navigation Link View Helper</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-about-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Home Page</title>
		<link>http://zf.gm-ram.com/posts/the-home-page/</link>
		<comments>http://zf.gm-ram.com/posts/the-home-page/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 19:49:39 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Controller]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=399</guid>
		<description><![CDATA[The home page is rendered by the index action handler of the index controller. The IndexController class is stored in the file IndexController.php inside the application/controllers directory. The skeleton for the class code is as follows: class IndexController extends Zend_Controller_Action &#123; // Insert the action handlers here &#125; The index action handler is an empty [...]]]></description>
			<content:encoded><![CDATA[<p>The home page is rendered by the index action handler of the index controller.<span id="more-399"></span></p>
<p>The <strong>IndexController</strong> class is stored in the file <em>IndexController.php</em> inside the <em>application/controllers</em> directory. The skeleton for the class code is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> IndexController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Insert the action handlers here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The index action handler is an empty function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The functionality is contained within the view script:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabPane</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'tabs'</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index/index/welcome.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Welcome'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tabContainer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tabs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This makes use of a couple of view helpers supplied by the <strong>ZendX_JQuery</strong> module.</p>
<p>The <strong>ZendX_JQuery_View_Helper_TabPane</strong> helper is used to build up a set of tabs; here there is only one.</p>
<p>The <strong>ZendX_JQuery_View_Helper_TabContainer</strong> helper is used to render the tab container.</p>
<p>The helper also adds the necessary code to the header, in order to initiate the tab container on the page being loaded, in accordance with the usual jQuery usage.</p>
<p>The contents of the tab are container in a separate script file called <em>welcome.phtml</em>, which is located in the <em>index</em> sub-directory:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h1&gt;Welcome to the GM-RAM Website!&lt;/h1&gt;
&nbsp;
&lt;p&gt;
  GM-RAM is a company whose business is software development 
  and consultancy.
&lt;/p&gt;
&nbsp;
&lt;p&gt;
  Here you can find information 
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">navLink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'about_page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'about the company'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
  and <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">navLink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contact_page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'how to contact us'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.
&lt;/p&gt;
&nbsp;
&lt;p&gt;
  You can also find 
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">navLink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'blogs_page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'details of our blogs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
  and any projects we are working on.
&lt;/p&gt;</pre></div></div>

<p>The script makes use of the <strong>Default_View_Helper_NavLink</strong> custom helper in order to render the navigation links. I shall look at the implementation of this in my next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-home-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Sample Application Layout</title>
		<link>http://zf.gm-ram.com/posts/the-sample-application-layout/</link>
		<comments>http://zf.gm-ram.com/posts/the-sample-application-layout/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 13:52:16 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ZendX_JQuery]]></category>
		<category><![CDATA[Zend_Layout]]></category>
		<category><![CDATA[Zend_Navigation]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=303</guid>
		<description><![CDATA[We looked at Zend_Layout in general terms in the previous now; now we are going to examine the main layout script used in the sample application. The script begins by rendering the DOCTYPE at the head of the page: &#60;?php echo $this-&#62;doctype&#40;&#41; . PHP_EOL; ?&#62; This has previously been set by the custom view resource [...]]]></description>
			<content:encoded><![CDATA[<p>We looked at Zend_Layout in general terms in the previous now; now we are going to examine the main layout script used in the sample application.<span id="more-303"></span></p>
<p>The script begins by rendering the DOCTYPE at the head of the page:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctype</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This has previously been set by the custom view resource plugin, as described in the previous post <a href="/posts/bootstrapping-the-application-a-custom-view-resource-plugin/">Bootstrapping the Application: a Custom View Resource Plugin</a>.</p>
<p>The rest of the page is enclosed inside an <strong>html</strong> block:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span> 
  <span style="color: #990000;">dir</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ltr&quot;</span> lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;en&quot;</span> xml<span style="color: #339933;">:</span>lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;!--</span> Page content is rendered here <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The html tag has the following attributes set:</p>
<ul>
<li><strong>xmlns</strong>: This specifies the namespace to use; it is required, as the DOCTYPE is set to XHTML, and it is set to the standard value <a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>.</li>
<li><strong>dir</strong>: This specifies the text direction for the content. It is set to <strong>ltr</strong> (left to right), which is the correct value for English.</li>
<li><strong>lang</strong>: This specifies a language code for the content. It is set to <strong>en</strong> (English).</li>
<li><strong>xml:lang</strong>: This specifies a language code for the content in XHTML documents. It is set to <strong>en</strong> (English).</li>
</ul>
<p>Inside the html block are the <strong>head</strong> and <strong>body</strong> blocks:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;!--</span> Head content is rendered here <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;!--</span> Body content is rendered here <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The head block is generated programmatically using Zend Framework view helpers:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Title</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GM-RAM Limited'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Metadata</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span>
  <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text/html; charset=UTF-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Language'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'en-GB'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'copyright'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Copyright '</span> <span style="color: #339933;">.</span> 
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">placeholder</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'copyrightDate'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' GM-RAM Limited'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'verify-v1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'...'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #666666; font-style: italic;">// Google verification code</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// jQuery</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocalPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/jquery-1.3.2.min.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setUiLocalPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/jquery-ui-1.7.2.custom.min.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStylesheet</span>
  <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/smoothness/jquery-ui-1.7.2.custom.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Links</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/default.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'shortcut icon'</span><span style="color: #339933;">,</span> 
  <span style="color: #0000ff;">'href'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'/img/favicon.ico'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-icon'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The view helpers used are:</p>
<ul>
<li><strong>Zend_View_Helper_HeadTitle</strong> (headTitle)</li>
<li><strong>Zend_View_Helper_HeadMeta</strong> (headMeta)</li>
<li><strong>Zend_View_Helper_HeadLink</strong> (headLink)</li>
<li><strong>ZendX_JQuery_View_Helper_JQuery</strong> (jQuery)</li>
</ul>
<p>These all employ the same pattern of usage: one or more calls are made to the relevant function, which aggregates the content to be rendered; each call returns the content so far, but only the last call is actually echoed to the page.</p>
<p>The above code should be fairly self-explanatory in terms of what is being rendered. The call to <strong>headTitle</strong> is used to generate the <strong>title</strong> element; the calls to <strong>headMeta</strong> are used to generate the various metadata elements; the calls to <strong>headLink</strong> are used to add the links to the stylesheet and shortcut icon. As the site makes use of the <strong>jQuery</strong> JavaScript library, there are calls to the jQuery view helper to generate the appropriate elements for including the necessary JavaScript files and also generating the code which sets jQuery to perform certain actions on start up; the latter will be covered in more detail in later posts.</p>
<p>The skeleton structure of the body section is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;wrapper&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;!--</span> <span style="color: #990000;">Header</span> content is rendered here <span style="color: #339933;">--&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;!--</span> Main page content is rendered here <span style="color: #339933;">--&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;footer&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;!--</span> Footer content is rendered here <span style="color: #339933;">--&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The header breaks down into:</p>
<ul>
<li>The navigation menu at the top</li>
<li>The company&#8217;s logo</li>
<li>The description of the company&#8217;s area of business</li>
<li>The company&#8217;s phone number</li>
</ul>
<p>The navigation menu is rendered like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  &lt;div id=&quot;nav&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">navigation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">menu</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/div&gt;</pre></div></div>

<p>This uses the Zend_Navigation object, which is initialised using the configuration file as described in the post <a href="/posts/bootstrapping-the-application-the-standard-navigation-resource-plugin/">Bootstrapping the Application: the Standard Navigation Resource Plugin</a>. Here, the pages in the navigation are rendered as a menu, which generates an unordered list of links.</p>
<p>The other three elements are rendered as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  &lt;img src=&quot;/img/logo.gif&quot; alt=&quot;GM-RAM Limited&quot; title=&quot;GM-RAM Limited&quot; /&gt;
  &lt;div&gt;Software Development and Consultancy&lt;/div&gt;
  &lt;div&gt;
    &lt;strong&gt;Phone:&lt;/strong&gt; 
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">placeholder</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'phoneNumber'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/div&gt;</pre></div></div>

<p>Note the use of the placeholder view helper. This makes use of the placeholders set up using a custom resource plugin, as described in the post <a href="/posts/bootstrapping-the-application-a-custom-view-resource-plugin/">Bootstrapping the Application: a Custom View Resource Plugin</a>.</p>
<p>The main page content simply consists of a call to fetch the layout object, so that its content member variable can be rendered:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">content</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This results in the output generated by the view script for the specific page being injected into the content div.</p>
<p>The footer consists of the following markup:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div&gt;
  &lt;a href=&quot;http://framework.zend.com/&quot;&gt;
    &lt;img src=&quot;/img/PoweredBy_ZF_4LightBG.png&quot; alt=&quot;Zend Framework&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;
  Copyright &amp;copy; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">placeholder</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'copyrightDate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
  GM-RAM Limited
&lt;/div&gt;</pre></div></div>

<p>Note again the use of the placeholder view helper.</p>
<p>In the next post, I shall look at the stylesheet for the website, in particular how it applies to the layout script.</p>
]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-sample-application-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

