<?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>Blue Horn &#187; PHP</title>
	<atom:link href="http://bluehorn.co.nz/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://bluehorn.co.nz</link>
	<description>New Zealand Web Design &#38; Development (PHP 5, MySQL, Symfony Framework, Apache, Linux)</description>
	<lastBuildDate>Tue, 29 Nov 2011 22:23:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Speed up Symfony by installing APC on Ubuntu</title>
		<link>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/</link>
		<comments>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:44:59 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[Symfony Resources]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=338</guid>
		<description><![CDATA[APC (Alternative PHP Cache) is an open source code PHP code cache and optimizer (or code accelerator). It is a necessary companion to any Symfony project. So here we go: sudo apt-get update sudo apt-get install php5-dev apache2-dev build-essential apache2-threaded-dev php-pear sudo pecl install apc Then update /etc/php5/apache2/php.ini and add this line: extension=apc.so Have fun! [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>APC (Alternative PHP Cache) is an open source code PHP code cache and optimizer (or code accelerator). It is a necessary companion to any Symfony project. <span id="more-338"></span>So here we go:</p>
<p>sudo apt-get update<br />
sudo apt-get install php5-dev apache2-dev build-essential apache2-threaded-dev php-pear<br />
sudo pecl install apc</p>
<p>Then update /etc/php5/apache2/php.ini and add this line:</p>
<p>extension=apc.so</p>
<p>Have fun!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Popular websites powered by PHP</title>
		<link>http://bluehorn.co.nz/2009/09/26/popular-websites-powered-by-php/</link>
		<comments>http://bluehorn.co.nz/2009/09/26/popular-websites-powered-by-php/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 15:44:50 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=325</guid>
		<description><![CDATA[Just a handy list for me and anyone else out there. Most popular high traffic websites only. Wikipedia, Facebook, Friendster, Yahoo, Delicious, Youtube, Digg, WordPress, Tagged, W3Counter, MyYearBook No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Just a handy list for me and anyone else out there. Most popular high traffic websites only.</p>
<p>Wikipedia, Facebook, Friendster, Yahoo, Delicious, Youtube, Digg, WordPress, Tagged, W3Counter, MyYearBook</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/09/26/popular-websites-powered-by-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Susan Mofo: An Author, a Poet and a Health Practitioner</title>
		<link>http://bluehorn.co.nz/2009/09/18/susan-mofo-an-author-a-poet-and-a-health-practitioner/</link>
		<comments>http://bluehorn.co.nz/2009/09/18/susan-mofo-an-author-a-poet-and-a-health-practitioner/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 01:06:19 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Portfolios]]></category>
		<category><![CDATA[Websites using Symfony]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony 1.2]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=319</guid>
		<description><![CDATA[Susan Mofo is an author, a poet, and a health practitioner. And at the moment she is working to finish her first music CD! Susanmofo.com is a simple but effective website for Susan's official online presence, to promote her book, CD, and physiotherapy. No related posts. Related posts brought to you by Yet Another Related [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Susan Mofo is an author, a poet, and a health practitioner. And at the moment she is working to finish her first music CD! <a href="http://susanmofo.com" target="_blank">Susanmofo.com</a> is a simple but effective website for Susan's official online presence, to promote her book, CD, and physiotherapy.</p>
<p style="text-align: center;"><a href="http://susanmofo.com" target="_blank"><img class="aligncenter size-thumbnail wp-image-320" style="border: 1px solid black;" title="susanmofo.com" src="http://bluehorn.co.nz/wp-content/uploads/2009/09/screenshot-4-150x150.png" alt="susanmofo.com" width="150" height="150" /></a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/09/18/susan-mofo-an-author-a-poet-and-a-health-practitioner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony 1.2 sfForm formatter to add stars on required fields</title>
		<link>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/</link>
		<comments>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 11:16:27 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony 1.2]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=290</guid>
		<description><![CDATA[The following is a form formatter class I developed to automatically add stars * on required fields. Feel free to use it and let me know if it can be improved. You might ask, why not just use setLabels? Firstly, if you already set required fields to true/false in setValidators, why do you have to [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The following is a form formatter class I developed to automatically add stars * on required fields. Feel free to use it and let me know if it can be improved.</p>
<p>You might ask, why not just use setLabels?</p>
<p>Firstly, if you already set required fields to true/false in setValidators, why do you have to add the stars manually again in setLabels? It just doesn't make sense!</p>
<p>Secondly, using setLabels to add stars is interfering with language translation.</p>
<p>Thirdly, this is I believe a proper (or proper-ish?) way to do this kind of things with sfForm.</p>
<p><span id="more-290"></span></p>
<p>OK, let's get into it!</p>
<p>Below is an example on how to use it in your form class</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>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> yourForm <span style="color: #000000; font-weight: bold;">extends</span> sfForm
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</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;">setWidgets</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'first_name'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'last_name'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'email'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">128</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #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;">setValidators</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'first_name'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorString<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'last_name'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorString<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'email'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorEmail<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">128</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$decorator</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sidFormFormatter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</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;">widgetSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFormFormatter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$decorator</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;">widgetSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setFormFormatterName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is optional but you might want to add the following into your css (e.g.: main.css)</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">em<span style="color: #6666ff;">.required</span> <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>font-weight<span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
label<span style="color: #6666ff;">.required</span> <span style="color: #00AA00;">&#123;</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>Last but most importantly, save this formatter class in your project lib folder as sidFormFormatter.php:</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>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> sidFormFormatter <span style="color: #000000; font-weight: bold;">extends</span> sfWidgetFormSchemaFormatter <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> 
    <span style="color: #000088;">$rowFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #009933; font-weight: bold;">%e</span>rror%<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formRow<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formLabel<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;%label%&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formField<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #009933; font-weight: bold;">%f</span>ield%<span style="color: #000099; font-weight: bold;">\n</span>%help%&lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>%hidden_fields%&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$helpFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div class=&quot;fieldHelp&quot;&gt;%help%&lt;/div&gt;'</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorRowFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #009933; font-weight: bold;">%e</span>rrors%&lt;br /&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorListFormatInARow</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;<span style="color: #009933; font-weight: bold;">%e</span>rrors%&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorRowFormatInARow</span> <span style="color: #339933;">=</span>  <span style="color: #0000ff;">&quot;&lt;li class=<span style="color: #000099; font-weight: bold;">\&quot;</span>error<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;darr; <span style="color: #009933; font-weight: bold;">%e</span>rror% &amp;darr;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$namedErrorRowFormatInARow</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;li class=<span style="color: #000099; font-weight: bold;">\&quot;</span>error<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;darr; <span style="color: #009933; font-weight: bold;">%e</span>rror% &amp;darr;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$decoratorFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%c</span>ontent%&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * @var sfValidatorSchema
   */</span>
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$validatorSchema</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * @var array
   */</span>
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Constructor
   *
   * Params:
   *  - &quot;required_label_class_name&quot; css class name for label tag when the field is required field, the default is 'required'.
   *  - &quot;required_label_format&quot; default is '%label% &lt;em class=&quot;required&quot;&gt;*&lt;/em&gt;'.
   *
   * @param sfWidgetFormSchema $widgetSchema
   * @param sfValidatorSchema $validatorSchema
   * @param array $params
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span>sfWidgetFormSchema <span style="color: #000088;">$widgetSchema</span><span style="color: #339933;">,</span> sfValidatorSchema <span style="color: #000088;">$validatorSchema</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$validatorSchema</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span>
    parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgetSchema</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Returns parameter identified with $name or if does not exist, returns $default.
   *
   * @param string $name
   * @param mixed $default
   * @return mixed
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getParameter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$default</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</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><span style="color: #339933;">!</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;">params</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$default</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Generates a label for the given field name.
   *
   * @param  string $name        The field name
   * @param  array  $attributes  Optional html attributes for the label tag
   *
   * @return string The label tag
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> generateLabel<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$is_required</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</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;">validatorSchema</span> and <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;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$validator</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">/* @var $validator sfValidatorBase */</span>
&nbsp;
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$validator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$class_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required_label_class_name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$class_name</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$class_name</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$is_required</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">generateLabel</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$is_required</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$format</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required_label_format'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%label% &lt;em class=&quot;required&quot;&gt;*&lt;/em&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%label%'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That's it! Don't forget to "symfony cc" (clear cache).</p>
<p>Happy coding!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Smile Care Centre, dentistry with a gentle touch</title>
		<link>http://bluehorn.co.nz/2009/02/03/smile-care-centre-dentistry-with-a-gentle-touch/</link>
		<comments>http://bluehorn.co.nz/2009/02/03/smile-care-centre-dentistry-with-a-gentle-touch/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 06:39:46 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Portfolios]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=173</guid>
		<description><![CDATA[Smile Care Centre is a website that Nathan has developed recently for a dentist. The website features an online appointment form where Smile Care Centre's patients can make an appointment anywhere anytime 24/7. No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://smilecarecentre.co.nz/" target="_blank">Smile Care Centre</a> is a website that Nathan has developed recently for a dentist. The website features an <a href="http://smilecarecentre.co.nz/online-appointment/" target="_blank">online appointment form</a> where Smile Care Centre's patients can make an appointment anywhere anytime 24/7.</p>
<div id="attachment_174" class="wp-caption aligncenter" style="width: 220px"><a href="http://bluehorn.co.nz/wp-content/uploads/2009/02/smilecarecentre_co_nz.jpg" target="_blank"><img class="size-medium wp-image-174" title="Smile Care Centre" src="http://bluehorn.co.nz/wp-content/uploads/2009/02/smilecarecentre_co_nz-300x295.jpg" alt="Click for larger image" width="210" height="207" /></a><p class="wp-caption-text">Click for larger image</p></div>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/03/smile-care-centre-dentistry-with-a-gentle-touch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brevettinews</title>
		<link>http://bluehorn.co.nz/2009/02/03/brevettinews/</link>
		<comments>http://bluehorn.co.nz/2009/02/03/brevettinews/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 06:22:36 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Portfolios]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=170</guid>
		<description><![CDATA[Brevettinews.it (site is now not available) was a website that we have developed sometime ago for an Italian lawyer. We successfully developed the website in PHP, MySQL, and Apache. Brevettinews features news, articles, mailing list, gallery, and etc. No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Brevettinews.it (site is now not available) was a website that we have developed sometime ago for an Italian lawyer. We successfully developed the website in PHP, MySQL, and Apache. Brevettinews features news, articles, mailing list, gallery, and etc.</p>
<div id="attachment_171" class="wp-caption aligncenter" style="width: 208px"><a href="http://bluehorn.co.nz/wp-content/uploads/2009/02/brevettinews_it.jpg" target="_blank"><img class="size-medium wp-image-171" title="Brevettinews snapshot" src="http://bluehorn.co.nz/wp-content/uploads/2009/02/brevettinews_it-283x300.jpg" alt="" width="198" height="210" /></a><p class="wp-caption-text">Click for larger image</p></div>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/03/brevettinews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Symfony versions in the same environment</title>
		<link>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/</link>
		<comments>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 09:40:04 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=145</guid>
		<description><![CDATA[I've been using this trick from symfonynerds to run multiple Symfony versions in the same environments. I can now work on projects built on Symfony 1.0, 1.1, and 1.2 simultaneously in the same environment (Ubuntu 8.10). So now, when I want to create a Symfony 1.0 project, I would just execute "$ symfony10 init-project myproject". [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I've been using this trick from <a href="http://symfonynerds.com/blog/?p=123" target="_blank">symfonynerds to run multiple Symfony versions in the same environments</a>. I can now work on projects built on Symfony 1.0, 1.1, and 1.2 simultaneously in the same environment (Ubuntu 8.10).</p>
<p>So now, when I want to create a Symfony 1.0 project, I would just execute "$ symfony10 init-project myproject". And then in the project I would use "$ ./symfony cc" instead of "$ symfony cc".</p>
<p>It worths mentioning that I think this trick is good for development environment but "svn:externals" trick or Symfony freeze are better for production/deployment as each project will have their own copy of Symfony Framework.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I like Symfony Framework</title>
		<link>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/</link>
		<comments>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 21:49:07 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=55</guid>
		<description><![CDATA[I have been doing Java programming for quite a few years. Java is where I got my OOP lessons from and it just makes sense to me, from the multi-threading model, interfaces, abstract classes, encapsulation, to the bean. I became known as Java man, because 1) I was born in Java island, 2) I program [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have been doing Java programming for quite a few years. Java is where I got my OOP lessons from and it just makes sense to me, from the multi-threading model, interfaces, abstract classes, encapsulation, to the bean.</p>
<p>I became known as Java man, because 1) I was born in Java island, 2) I program Java, 3) I can speak Javanese, and 4) even though unrelated, I also do Javascript.<span id="more-55"></span></p>
<p>On the other hand, I have also been doing a bit of PHP4. Coming from a Java background, PHP4 Object Oriented seems backward, but I love the flexibility of PHP and how it feels right for developing websites.</p>
<p>So when PHP5 with java like OO features was released, I was very ecstatic (in a normal kind of way). And since then I've been looking for a PHP framework that takes full advantage of that java like OO features. I tried few frameworks before currently settled with <a title="Symfony Framework" href="http://symfony-project.org" target="_blank">Symfony Framework</a>.</p>
<p><a href="http://symfony-project.org" target="_blank"><img class="alignleft size-full wp-image-64" style="border: 0pt none; margin: 10px;" title="Symfony" src="http://bluehorn.co.nz/wp-content/uploads/2008/12/symfony.gif" alt="" width="177" height="48" /></a><a title="Symfony Framework" href="http://www.symfony-project.org/" target="_blank">Symfony Framework</a> is a full-stack (comprehensive and complete) framework written in <a title="PHP website" href="http://php.net/" target="_blank">PHP5</a> that take advantage of the Java like OO of PHP5.</p>
<p>Here's few things that I like about Symfony ...</p>
<h3>Well known PHP libraries in one framework</h3>
<p>Symfony Framework does not reinvent the wheel like many other frameworks, instead it integrated the best breed, well known, and matured PHP libraries like <a title="PEAR" href="http://pear.php.net/" target="_blank">PEAR</a>, <a title="Propel" href="http://propel.phpdb.org/" target="_blank">Propel</a>, <a title="Phing" href="http://phing.info/" target="_blank">Phing</a>, and more. I've used PEAR in many occasions before started with Symfony. I've also used ORM (what Propel is) and have used Apache Ant (<a title="Phing" href="http://phing.info/trac/" target="_blank">what Phing is based on</a>). So although I still had to spend time learning Symfony, I was already familiar with its components.</p>
<h3>Plugins</h3>
<p>Symfony supports plugin and hence there are so <a title="Symfony plugins" href="http://www.symfony-project.org/plugins/" target="_blank">many plugins available for Symfony</a>. There are plugins for YUI, Extjs, Doctrine, Smarty, Prototype, JQuery, and more.</p>
<p>There are also high level plugins to add complete features to a Symfony project like:</p>
<ul>
<li>User management plugin</li>
<li>CMS plugin</li>
<li>Blog plugin</li>
<li>Forum plugin</li>
<li>Wiki plugin</li>
<li>Media assets management plugin</li>
<li>Lucene plugin</li>
<li><a title="Symfony plugins" href="http://www.symfony-project.org/plugins/" target="_blank">And many many more</a></li>
</ul>
<p>All of those are available to every Symfony developers list of arsenal. Plugins can be installed into Symfony project manually or via PEAR.</p>
<h3>Scafolding</h3>
<p>One of the best features of Symfony is its CLI commands. You can start a Symfony project in seconds. Just type a command line and all the skeleton of your project is created for you (including skeleton for your project's unit tests). No need to reinvent your own file structures, but if you're not happy with Symfony's default file structures, you can change it.</p>
<h3>Works well with Eclipse</h3>
<p>This one is quite a biggie to me. <a title="Eclipse IDE" href="http://www.eclipse.org/" target="_blank">Eclipse</a> is arguably the best free Java based IDE that has grown (so big) to support many (many!) programming languages including PHP. Personally, I use <a title="Eclipse PDT" href="http://www.eclipse.org/pdt/" target="_blank">Eclipse PDT</a>.</p>
<p>I particularly like the way Eclipse provides auto code completion for Symfony. It is able to parse the classes in your Symfony project and provides auto code completion for them. Notepad just doesn't cut it any longer since I've used Eclipse.</p>
<p>However, there are tricks that you need to know to get Eclipse PDT to code completion all of your Symfony classes (will write in another post).</p>
<h3>Used by big companies</h3>
<p>I'd still use Symfony even if there's no big companies are using it but it's good to know that big companies are starting to notice this framework.</p>
<ul>
<li><a title="Yahoo! Bookmarks using Symfony" href="http://www.symfony-project.org/blog/2006/10/28/yahoo-bookmarks-uses-symfony" target="_blank">Yahoo is using Symfony to develop Yahoo! Bookmarks</a></li>
<li><a title="Delicious using Symfony" href="http://www.symfony-project.org/blog/2007/10/02/delicious-preview-built-with-symfony" target="_blank">Delicious preview was rumored to have been built using Symfony</a>.</li>
</ul>
<h3>Open source (MIT License)</h3>
<p>Last but not least, Symfony is open source which mean the community (thousands of developers) is able to help to maintain it.</p>
<p>So there you go, few things I like about Symfony Framework</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

