<?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; CSS</title>
	<atom:link href="http://zf.gm-ram.com/topics/css/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>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>Pagination using Zend_Paginator</title>
		<link>http://zf.gm-ram.com/posts/pagination-using-zend_paginator/</link>
		<comments>http://zf.gm-ram.com/posts/pagination-using-zend_paginator/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 12:54:51 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Zend_Controller]]></category>
		<category><![CDATA[Zend_Db]]></category>
		<category><![CDATA[Zend_Paginator]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=652</guid>
		<description><![CDATA[Any web application that retrieves large amounts of data for display is bound to have the need to split that data over several pages. Developing the code to do this from scratch is not trivial, so it is extremely useful that the Zend Framework has the Zend_Paginator module, which assists with this task. Zend_Paginator works [...]]]></description>
			<content:encoded><![CDATA[<p>Any web application that retrieves large amounts of data for display is bound to have the need to split that data over several pages. Developing the code to do this from scratch is not trivial, so it is extremely useful that the Zend Framework has the Zend_Paginator module, which assists with this task.<span id="more-652"></span></p>
<p>Zend_Paginator works as follows:</p>
<ol>
<li>The paginator is passed either an actual set of data, or a database query that can be used to retrieve the data.</li>
<li>The paginator will by default retrieve the first page and 10 items on that page; the page and the items per page can be set at this point if necessary.</li>
<li>The paginator can be used to render a navigator, by retrieving the current page and the number of pages.</li>
<li>The paginator can be used to render the current page, by iterating over the paginator to retrieve each item in order.</li>
</ol>
<p>I shall give a concrete example of how this can be implemented below, based on an application I am currently developing.</p>
<p>First, let us start with the controller. In this instance, the controller is <strong>user</strong> and the action is <strong>index</strong>. The skeleton for this 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> UserController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action
<span style="color: #009900;">&#123;</span>
  <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>
    <span style="color: #666666; font-style: italic;">// Insert implementation here</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The current page will be passed via the URL as a parameter. The first task in the action handler is therefore to retrieve the page number. If it is not specified, it will default to 1.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Get the current page</span>
    <span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParam</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The next step is to construct a Zend_Db_Select object that represents the database query. To do this we need a database adapter; below, we assume that this has been created during the bootstrapping process and can be retrieved via the bootstrap object. The query simply retrieves all records from the user table, ordering them by the user&#8217;s display name.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Get the boostrap object</span>
    <span style="color: #000088;">$bootstrap</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInvokeArg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bootstrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Get the database adapter</span>
    <span style="color: #000088;">$dbAdapter</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bootstrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Create the selection object</span>
    <span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dbAdapter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now we have the select object, we can use it to create the paginator object.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Get a Paginator object using Zend_Paginator's built-in factory</span>
    <span style="color: #000088;">$paginator</span> <span style="color: #339933;">=</span> Zend_Paginator<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$select</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We can then set the number of items per page and the current page.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Set the number of items to show per page</span>
    <span style="color: #000088;">$paginator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setItemCountPerPage</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Select the requested page</span>
    <span style="color: #000088;">$paginator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCurrentPageNumber</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Finally, we should pass the paginator object to the view script.</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;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginator</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$paginator</span><span style="color: #339933;">;</span></pre></div></div>

<p>The view script used is given below. Note that the application uses Zend_Layout, so only the unique content of the page needs to be generated here.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h3&gt;User Management&lt;/h3&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Display pagination control</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginationControl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginator</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Elastic'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'paginator.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th width=&quot;25%&quot;&gt;Username&lt;/th&gt;
      &lt;th width=&quot;25%&quot;&gt;Role&lt;/th&gt;
      &lt;th width=&quot;50%&quot;&gt;Name&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #666666; font-style: italic;">// Render each item for the current page in a table row</span>
    <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;">paginator</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;tr&gt;
      &lt;td&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;">escape</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
      &lt;td&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;">escape</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ucfirst</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'role'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
      &lt;td&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;">escape</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
    &lt;/tr&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/tbody&gt;
&lt;/table&gt;</pre></div></div>

<p>The script uses the <strong>PaginationControl</strong> view helper to render the navigator. The view script for the navigator markup is specified as one of the parameters as <em>paginator.phtml</em>; this script is found in the <em>/application/views/scripts</em> directory. The following standard script is used:</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pageCount</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;paginator&quot;&gt;
&nbsp;
&lt;!-- First page link --&gt;
<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;">previous</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &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;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
    First
  &lt;/a&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;span class=&quot;disabled&quot;&gt;First&lt;/span&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!-- Previous page link --&gt;
<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;">previous</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &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;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">previous</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
    &lt; Previous
  &lt;/a&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;span class=&quot;disabled&quot;&gt;&lt; Previous&lt;/span&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!-- Next page link --&gt;
<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;">next</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &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;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">next</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
    Next &gt;
  &lt;/a&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;span class=&quot;disabled&quot;&gt;Next &gt;&lt;/span&gt; |
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!-- Last page link --&gt;
<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;">next</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &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;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
    Last
  &lt;/a&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;span class=&quot;disabled&quot;&gt;Last&lt;/span&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The section used to render the current page as a table makes use of the fact that the paginator object can be iterated over to retrieve each item on the current page in turn.</p>
<p>The following styling is applied to the navigator:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.paginator</span> <span style="color: #00AA00;">&#123;</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: #00AA00;">&#125;</span></pre></div></div>

<p>The following styling is applied to the table:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
th<span style="color: #00AA00;">,</span> td <span style="color: #00AA00;">&#123;</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: #00AA00;">&#125;</span>
&nbsp;
th <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#4E7DD1</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/pagination-using-zend_paginator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Sample Application Stylesheet</title>
		<link>http://zf.gm-ram.com/posts/the-sample-application-stylesheet/</link>
		<comments>http://zf.gm-ram.com/posts/the-sample-application-stylesheet/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:41:47 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://zf.gm-ram.com/?p=342</guid>
		<description><![CDATA[The application makes use of two stylesheets. The first is called default.css and is located in the htdocs/css directory. The second is called jquery-ui-1.7.2.custom.css and is located in the htdocs/css/smoothness, along with its associated image files; this was created using the jQuery UI ThemeRoller and is used by the jQuery UI components. We will be [...]]]></description>
			<content:encoded><![CDATA[<p>The application makes use of two stylesheets. The first is called <em>default.css</em> and is located in the <em>htdocs/css</em> directory. The second is called <em>jquery-ui-1.7.2.custom.css</em> and is located in the <em>htdocs/css/smoothness</em>, along with its associated image files; this was created using the <a href="http://jqueryui.com/themeroller/">jQuery UI ThemeRoller</a> and is used by the jQuery UI components. We will be looking at the first of these in this article.<span id="more-342"></span></p>
<p>The stylesheet starts with the general styling for the page:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.9em</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.3em</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;">3em</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">/img/background.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> trebuchet ms<span style="color: #00AA00;">,</span> tahoma<span style="color: #00AA00;">,</span> verdana<span style="color: #00AA00;">,</span> arial<span style="color: #00AA00;">,</span> helvetica<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 CSS elements fall into the following groupings:</p>
<ul>
<li>Text styling: The font family and size; the line height; the text alignment.</li>
<li>Background: The background image.</li>
<li>The page border: The margin; the padding; the thick line across the top.</li>
</ul>
<p>Then come the styling for the header elements:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</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;
h2 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.2em</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;
h3<span style="color: #00AA00;">,</span> h4<span style="color: #00AA00;">,</span> h5<span style="color: #00AA00;">,</span> h6 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</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></pre></div></div>

<p>The headings are in bold text and are larger than normal text; they get smaller from h1 to h6 as is customary.</p>
<p>Next come the link styling:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #00AA00;">,</span> a<span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span> a<span style="color: #3333ff;">:visited</span><span style="color: #00AA00;">,</span> a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#930</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Links are not underlined, as is the default behaviour. When the user hovers over a link, the colour changes; otherwise it stays the same.</p>
<p>The images are styled to stop them being given a border, if they are also links:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">img <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The remaining styling is concerned with the page layout.</p>
<p>The first part is the most important, a wrapper which fixes the page content width and centers it within the page:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#wrapper</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;">800px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The top section within this is the header, which has its contents centered by default:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#header</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: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>However, the navigation is right-aligned; it is rendered in the form of an unordered list, but this is styled to be displayed as a horizontal row of links:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#nav</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: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#nav</span> ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#nav</span> li <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</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></pre></div></div>

<p>The styling for the content is pretty simple:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#content</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The following sets the width of the submit button on the contact page:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#submit</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The footer has its content centered, like the header:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</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></pre></div></div>

<p>Finally, there are stylings for error text (coloured red) and warning text (coloured orange):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.error</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.warning</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> orange<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://zf.gm-ram.com/posts/the-sample-application-stylesheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

