<?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>devexp &#187; Symfony</title>
	<atom:link href="http://www.devexp.eu/category/devexp/frameworks/symfony/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devexp.eu</link>
	<description>DEVelopment EXPerience, shared with the world!</description>
	<lastBuildDate>Fri, 28 Oct 2011 12:07:45 +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>Symfony Live 2010 #sflive2010</title>
		<link>http://www.devexp.eu/2010/02/10/symfony-live-2010-sflive2010/</link>
		<comments>http://www.devexp.eu/2010/02/10/symfony-live-2010-sflive2010/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 07:21:54 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Paris]]></category>
		<category><![CDATA[Symfony Live 2010]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=1014</guid>
		<description><![CDATA[On the 16-17th of February the Symfony Live 2010 conference will be held in Paris. A lot promising developers and evangelists will be speakers on this conference like: Fabien Potencier Jonathan Wage Dustin Whittle Stefan Koopmanschap &#8230; My colleague and &#8230; <a href="http://www.devexp.eu/2010/02/10/symfony-live-2010-sflive2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://www.devexp.eu/wp-content/uploads/2010/02/banner_square.jpg"><img class="alignright size-full wp-image-1015" title="Symfony Live 2010" src="http://www.devexp.eu/wp-content/uploads/2010/02/banner_square.jpg" alt="" width="215" height="215" /></a>On the 16-17th of February the Symfony Live 2010 conference will be held in Paris. A lot promising developers and evangelists will be speakers on this conference like:</p>
<ul>
<li>Fabien Potencier</li>
<li>Jonathan Wage</li>
<li>Dustin Whittle</li>
<li>Stefan Koopmanschap</li>
<li>&#8230;</li>
</ul>
<p>My colleague and I will attend this conference and, if everything goes well, we will try to update our DevExp blog with live feedback or summarized posts on some of the most interesting sessions.</p>
<div class="shr-publisher-1014"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2010/02/10/symfony-live-2010-sflive2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to force symfony colors on windows with PuttyCyg?</title>
		<link>http://www.devexp.eu/2009/09/22/how-to-force-symfony-colors-on-windows-with-cygwinputtycyg/</link>
		<comments>http://www.devexp.eu/2009/09/22/how-to-force-symfony-colors-on-windows-with-cygwinputtycyg/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 13:18:14 +0000</pubDate>
		<dc:creator>Van de Voorde Toni</dc:creator>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=936</guid>
		<description><![CDATA[Those of you who’re developing with symfony under windows will have noticed that, when running tasks in the command prompt, no colors are used. This is because the windows command prompt isn’t compatible with the color notation. Most of you &#8230; <a href="http://www.devexp.eu/2009/09/22/how-to-force-symfony-colors-on-windows-with-cygwinputtycyg/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Those of you who’re developing with symfony under windows will have noticed that, when running tasks in the command prompt, no colors are used. This is because the windows command prompt isn’t compatible with the color notation.<br />
Most of you also have <a href="http://www.cygwin.com/">cygwin</a> installed (shame on you if you didn’t :p). But even if you run the tasks through “<a href="http://code.google.com/p/puttycyg/">PuttyCyg</a>”, which is fully compatible with the color notation, you will not benefit from the colors. </p>
<p>Why?</p>
<p><span id="more-936"></span><br />
The problem resides in the symfony class “sfAnsiColorFormatter” in the method “supportsColors($stream)”:</p>
<pre class="brush: php; title: ; notranslate">
  /**
   * Returns true if the stream supports colorization.
   *
   * Colorization is disabled if not supported by the stream:
   *
   *  -  windows
   *  -  non tty consoles
   *
   * @param mixed $stream A stream
   *
   * @return Boolean true if the stream supports colorization, false otherwise
   */
  public function supportsColors($stream)
  {
    return DIRECTORY_SEPARATOR != '\\' &amp;&amp; function_exists('posix_isatty') &amp;&amp; @posix_isatty($stream);
  }
</pre>
<p>The method supportsColors($stream) decides whether or not colors are supported. And as you can see, one of the checks is the directory separator which in our case will always return false because we are on a windows operating system. So even if you run tasks through puttycyg the directory separator will remain the same.</p>
<p><strong>Possibility 1</strong></p>
<p>If you always work through the puttycyg you could simply set the method to always return true, but in a command prompt it will look like this:<br />
<div id="attachment_946" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.devexp.eu/wp-content/uploads/2009/09/command_output.png"><img src="http://www.devexp.eu/wp-content/uploads/2009/09/command_output-300x236.png" alt="Dos Command Output" title="Dos Command Output" width="300" height="236" class="size-medium wp-image-946" /></a><p class="wp-caption-text">Dos Command Output</p></div></p>
<p><strong>Possibility 2</strong></p>
<p>Detect if cygwin is used. This way when you use the dos command the output will work and when cygwin is used you&#8217;ll have the colors <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>I checked the $_SERVER array to find something that could help me to distinguish the cygwin prompt with the dos prompt, and I found that the &#8216;PWD&#8217; key is only available on *nix shells. And when I print the value of $_SERVER['PWD'] in the cygwin prompt it gives me &#8220;/cygdrive/f/sandbox/adlogix/branch-3.2/frontend&#8221;. </p>
<p>Knowing that, here is how we can change the supportsColors method:</p>
<pre class="brush: php; title: ; notranslate">
  /**
   * Returns true if the stream supports colorization.
   *
   * Colorization is disabled if not supported by the stream:
   *
   *  -  windows
   *  -  non tty consoles
   *
   * @param mixed $stream A stream
   *
   * @return Boolean true if the stream supports colorization, false otherwise
   */
  public function supportsColors($stream)
  {
    $supported = DIRECTORY_SEPARATOR != '\\' &amp;&amp; function_exists('posix_isatty') &amp;&amp; @posix_isatty($stream);

    return $supported ? true : !is_bool(strpos(@$_SERVER['PWD'], &quot;/cygdrive&quot;));
  }
</pre>
<p>What I did, is still using the check symfony used, but when it returns false I do a second check to see if the $_SERVER['PWD'] exists and that it contains the String &#8220;/cygdrive&#8221;.</p>
<p>Now when I run the taks through cygwin I get the colors and when I run it in dos it displays correctly.<br />
<div id="attachment_950" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.devexp.eu/wp-content/uploads/2009/09/puttycyg-versus-dos.png"><img src="http://www.devexp.eu/wp-content/uploads/2009/09/puttycyg-versus-dos-300x187.png" alt="PuttyCyg versus Dos" title="PuttyCyg versus Dos" width="300" height="187" class="size-medium wp-image-950" /></a><p class="wp-caption-text">PuttyCyg versus Dos</p></div></p>
<p>I only tested it on my machine, so if you have troubles or a better way to do it, please let me know <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><strong>Update:</strong> This is only tested with symfony 1.2 and as from sf 1.3 there will be an option &#8211;color to force the colors.</p>
<p><strong>Update:</strong> For some reason it does not work in the cygwin bash shell. When I set the message manually (echo -e &#8220;\033[31mHello World\033[0m&#8221;) in the command the colors appear, but through symfony not.  I suspect that the cygwin bash shell miss interprets the returns of php, but I have no idea why it does work on puttyCyg (which only launches the cygwin shell) &#8230; probably some startup configuration of the bash ?!</p>
<div class="shr-publisher-936"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/09/22/how-to-force-symfony-colors-on-windows-with-cygwinputtycyg/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Basic forms with Symfony</title>
		<link>http://www.devexp.eu/2009/04/30/basic-forms-with-symfony/</link>
		<comments>http://www.devexp.eu/2009/04/30/basic-forms-with-symfony/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 11:12:57 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=726</guid>
		<description><![CDATA[Our goal is to create a little crud that contains 4 fields id (auto increment integer) name (varchar 50) value (double) type (0 or 1) What I will explain is how to change your fields in the form after creation &#8230; <a href="http://www.devexp.eu/2009/04/30/basic-forms-with-symfony/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><img class="alignright size-full wp-image-727" title="Symfony" src="http://www.devexp.eu/wp-content/uploads/2009/04/symfony.jpg" alt="Symfony" width="127" height="35" />Our goal is to create a little crud that contains 4 fields</p>
<p>id (auto increment integer)<br />
name (varchar 50)<br />
value (double)<br />
type (0 or 1)</p>
<p>What I will explain is how to change your fields in the form after creation with generation of a module. So we start with a clean module that contains 1 action class and 3 templates (new, edit and index) and 1 partial (form) that is included on the new and edit template.<br />
We created this module not by hand but with the very easy command: symfony propel:generate-module.</p>
<p><span id="more-726"></span>So what we want to do is quite easy, but if you are not used to working with forms, this is already a big struggle. So go to the action and you will see that in the executeNew method a form is initialized with an instance of a class (in our case DiscountForm).</p>
<pre class="brush: php; title: ; notranslate">
public function executeNew(sfWebRequest $request)
{
$this-&gt;form = new DiscountForm();
}
</pre>
<p>If you now go to the page in your browser you will see that the form is build up for you in a very basic way, containing no layout and just the 4 labels, the input fields and a submit button. If you want the user to see error messages when he has forgotten to fill in a required field or if you want to add a field to the form you can do that in the DiscountForm by adding a function configure().</p>
<pre class="brush: php; title: ; notranslate">
class DiscountForm extends BaseDiscountForm  {
public function configure() {
//insert extra data
}
}
</pre>
<p>Now, as we don&#8217;t want the user to select 0 or 1 when choosing his type, we let him use a dropdown with understandable content to choose from. 0 is discount and 1 is up count. The purpose of the type is that the number inserted in the value field will be added or subtracted.</p>
<p>To do this we create a public $type array containing the discount and up count in the Discount class in the model. We do this in the model class because, in this way, we can re-use this in other methods later as we might need this in the templates or other classes.</p>
<pre class="brush: php; title: ; notranslate">
static public $types = array(
'0' =&gt; 'Discount',
'1' =&gt; 'Up count',
);
</pre>
<p>And in the configure method we put this:</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;widgetSchema['type'] = new sfWidgetFormChoice(array(
'choices'  =&gt; Discount::$types,
'expanded' =&gt; true,
));
</pre>
<p>If you reload your view on this point you will see that the type field has changed to a radio button field, which is easier to read.</p>
<p>You can style the form by adding some attributes to your fields:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php echo $form['discount']-&gt;render(array('class' =&gt; 'page-input', 'size' =&gt; 5));  ?&gt;
</pre>
<p>Page-input is the class specified in the css and giving the field a proper layout and size is the width of the field, in this case 5.<br />
All other attributes your element can accept can be inserted like this.</p>
<p>That&#8217;s actually it, if you followed these easy steps, you created your own basic crud. How nice it all looks will all depend on the css you use. For a few templates on forms you can take a look at <a href="http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/" target="_blank">this post </a></p>
<div class="shr-publisher-726"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/30/basic-forms-with-symfony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony Form: unsetAllFieldsExcept()</title>
		<link>http://www.devexp.eu/2009/04/27/symfony-form-unsetallfieldsexcept/</link>
		<comments>http://www.devexp.eu/2009/04/27/symfony-form-unsetallfieldsexcept/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 12:37:31 +0000</pubDate>
		<dc:creator>Van de Voorde Toni</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=706</guid>
		<description><![CDATA[When creating forms in symfony which extends from a Base (ORM) class, you sometimes do not need all fields that Propel/Doctrine generates for you. If you want to remove them you have several ways to do so. 1. Unset the &#8230; <a href="http://www.devexp.eu/2009/04/27/symfony-form-unsetallfieldsexcept/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>When creating forms in symfony which extends from a Base (ORM) class, you sometimes do not need all fields that Propel/Doctrine generates for you. If you want to remove them you have several ways to do so.</p>
<p><b>1. Unset the fiels you don&#8217;t need.</b></p>
<pre class="brush: php; title: ; notranslate">
public function configure() {
  unset($this['field1'], $this['field2'], ... );
}
</pre>
<p>Simple way to remove the fields you don&#8217;t want, but if you change something in your database, which has an impact on that form (new column, foreignkey, etc ), it will be added in the (generated) super class. And if you don&#8217;t update the unset function with that extra field, it will be expected in the form. Unless you have unit tests for all your forms this could brake it without knowing it.</p>
<p><b>2. Override the setup function.</b></p>
<pre class="brush: php; title: ; notranslate">
/**
 * @override
 */
public function setup()
  {
    parent::setup();

    $this-&gt;setWidgets(...);

    $this-&gt;setValidators(...);
  }
</pre>
<p>Another way is to override the setup function and do your own widgets and validators initialization. This is a good way to only intialize the fields you really need, but you&#8217;ll have to do what your ORM generated for you.</p>
<p><b>3. Use a function which unsets all fields except the one you need (like the enableAllPluginsExcept function).</b></p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;unsetAllFieldsExcept(array(
      'field1',
      'field2',
      'field3',
      ...));
</pre>
<p>This would be usefull, because it will remove all fields you do not want to use, and even if new fields are added it will not use them. The drawback is that if you have 20 fields and only need to unset one of them, you&#8217;ll have more type work <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .<br />
Since it does not exist in symfony, I quickly created our own function. This function should be added in the class <u><em>BaseFormPropel.class</em></u>:</p>
<pre class="brush: php; title: ; notranslate">
abstract class BaseFormPropel extends sfFormPropel
{
  public function setup() {
  }

  protected function unsetAllFieldsExcept($fields = array()) {

    $unsetFields = array_diff(array_keys($this-&gt;getWidgetSchema()-&gt;getFields()), $fields);

    foreach($unsetFields as $value) {
      unset($this[$value]);
    }
  }
}
</pre>
<p><b>Which one to use ?</b><br />
None of them are better. But if you need to reset a majority of the fields the ORM has generated then I would go for the method 2. If you only need to unset the fields you do not want to use then I would use the function unsetAllFieldsExcept().</p>
<p>Which method do/would you use ?</p>
<div class="shr-publisher-706"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/27/symfony-form-unsetallfieldsexcept/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>sfWidgetFormInputCheckbox unchecked bug</title>
		<link>http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/</link>
		<comments>http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 12:33:37 +0000</pubDate>
		<dc:creator>Van de Voorde Toni</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[sfWidgetFormInputCheckbox]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=681</guid>
		<description><![CDATA[Ever tried to create a Symfony form with a check box input field, which by default should be unchecked ? No ? Well read on because it&#8217;s not that easy . This would be the code to print a check &#8230; <a href="http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Ever tried to create a Symfony form with a check box input field, which by default should be unchecked ? No ? Well read on because it&#8217;s not that easy <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>This would be the code to print a check box input field in a Symfony form:</p>
<pre class="brush: php; title: ; notranslate">
class CheckboxForm extends BaseCheckboxForm {
 public function configure() {
 $this-&gt;widgetSchema['field'] = new sfWidgetFormInputCheckbox();
 }
}
</pre>
<p>When you use the form to create something then by default the check box should be unchecked. And when you use this form for editing, then the check box should be checked if the object you try to edit has already been checked in the past.</p>
<p>If you try this code, you&#8217;ll see that the check box will always be checked. Even if you display this form to create a new object. Strange no ?</p>
<p><span id="more-681"></span></p>
<p>The problem is due to a bug in the Symfony sfWidgetFormInputCheckbox class. Even worse, this bug has been reported the first time 10 months ago (<a href="http://trac.symfony-project.org/ticket/3917" target="_blank">trac #3917</a>) and 1 month later (<a href="http://trac.symfony-project.org/ticket/3996" target="_blank">trac #3996</a>) and it&#8217;s still not fixed ! (grrrrr)</p>
<p>Until Symfony bug fixes this issue, there are 2 work a rounds you can use.</p>
<p><strong>1. Edit the sfWidgetFormInputCheckbox class and patch it:</strong></p>
<p><em>actual</em></p>
<pre class="brush: php; title: ; notranslate">
class sfWidgetFormInputCheckbox extends sfWidgetFormInput
{
 ...
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
 if (!is_null($value) &amp;&amp; $value !== false)
 {
 $attributes['checked'] = 'checked';
 }
 ...
 }
}
</pre>
<p><em>patched</em></p>
<pre class="brush: php; title: ; notranslate">
class sfWidgetFormInputCheckbox extends sfWidgetFormInput
{
 ...
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
 if (!is_null($value) &amp;&amp; $value !== false &amp;&amp; $value != 0)
 {
 $attributes['checked'] = 'checked';
 }
 ...
 }
}
</pre>
<p>I would not recommend this, because if like us, you have more than one Symfony environment, there is a chance that you could forget to patch it. And worse if Symfony releases a new version without the bug fix you&#8217;ll have to remember to re patch the file.</p>
<p><strong>2. Extend the sfWidgetFormInputCheckbox class and override the render method:</strong></p>
<p><em>Edit: Put this class in the lib folder and call it myOwnWidgetFormInputCheckbox.class.php. After that run symfony cc.</em></p>
<pre class="brush: php; title: ; notranslate">
/**
 * FIXME: This class can be removed if the sfWidgetFormInputCheckbox bug
 * has been resolved in symfony.
 */
class myOwnWidgetFormInputCheckbox extends sfWidgetFormInputCheckbox
{
 /**
 * Override render method due to symfony bug (http://trac.symfony-project.org/ticket/3917)
 */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
 if (!is_null($value) &amp;&amp; $value !== false &amp;&amp; $value != 0)
 {
 $attributes['checked'] = 'checked';
 } 

 if (!isset($attributes['value']) &amp;&amp; !is_null($this-&gt;getOption('value_attribute_value'))) {
 $attributes['value'] = $this-&gt;getOption('value_attribute_value');
 }

 return parent::render($name, null, $attributes, $errors);
 }
}
</pre>
<p>Your form class should then be changed to:</p>
<pre class="brush: php; title: ; notranslate">
class CheckboxForm extends BaseCheckboxForm {
 public function configure() {
 $this-&gt;widgetSchema['field'] = new myOwnWidgetFormInputCheckbox();
 }
}
</pre>
<p>This was very easy to solve, but we lost a lot of time in finding the reason why this stupido check box was always checked. And why the hell is this bug still not solved in Symfony ?</p>
<p>In the mean time patch your symfony or create your own checkbox widget <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<div class="shr-publisher-681"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>A few helpful PHP date methods</title>
		<link>http://www.devexp.eu/2009/04/14/a-few-helpfull-php-date-methods/</link>
		<comments>http://www.devexp.eu/2009/04/14/a-few-helpfull-php-date-methods/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 11:08:28 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[methods]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=639</guid>
		<description><![CDATA[For a lot of people dates in PHP are an issue, and the PHP functions aren&#8217;t sufficient enough to do all converts you need. Therefore you find a few easy PHP date conversion methods. Feel free to add your own &#8230; <a href="http://www.devexp.eu/2009/04/14/a-few-helpfull-php-date-methods/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>For a lot of people dates in PHP are an issue, and the PHP functions aren&#8217;t sufficient enough to do all converts you need.<br />
Therefore you find a few easy PHP date conversion methods. Feel free to add your own methods or requests in the comments as we know that these methods don&#8217;t cover everything. You can see it for yourself when you read the rest of this entry:</p>
<ul>
<li>get start and end date for the next two months in an array</li>
<li>get the datetime for a specific user culture in Symfony</li>
<li>get all days between a given start and end date and return it in an array</li>
<li>get the difference between two dates</li>
</ul>
<p><span id="more-639"></span></p>
<ol>
<li><strong>get start and end date for the next two months in an array </strong><span style="text-decoration: underline;"><br />
input</span>: nothing<br />
<span style="text-decoration: underline;">output</span>:<br />
array[0] = 1239706452<br />
array[1] = 1244976852<br />
<span style="color: #339966;">*updated -&gt; thx naholyr</span>
<pre class="brush: php; title: ; notranslate">
/**
 * get the next two months starting from today.
 *
 * @return array
 */
 public function getNextTwoMonths(){
 return array(time(), strtotime(’+2 month’));
 }
</pre>
</li>
<li><strong>get the datetime for a specific user culture in Symfony</strong><span style="text-decoration: underline;"><br />
input</span>: 16/09/08 <span style="text-decoration: underline;"><br />
output</span>: 2008-09-16 23:35:55
<pre class="brush: php; title: ; notranslate">
 /**
 * Parses a date String from a specific culture to a Date.
 *
 * input example: 16/09/08
 *
 * returns: DateTime (Date)
 * @param String $period
 * @return Array of DateTime objects
 */
 public function parseDate($period) {

 $userCulture =  sfContext::getInstance()-&gt;getUser()-&gt;getCulture();

 $timestamp = sfContext::getInstance()-&gt;getI18N()-&gt;getTimestampForCulture($period, $userCulture);

 $period = new DateTime(date('Y-m-d H:i:s', $timestamp));

 return $period;
 }
</pre>
</li>
<li><strong>get all days between a given start and end date and return it in an array.</strong><span style="text-decoration: underline;"><br />
input</span>: 2 DateTime dates<span style="text-decoration: underline;"><br />
output</span>: array of days<br />
day[0] = 2008-12-10<br />
day[1] = 2008-12-11
<pre class="brush: php; title: ; notranslate">
/**
 * With a given start and end date it will creates all the dates in between and return
 * it in an array.
 *
 * @param DateTime $startDate
 * @param DateTime $endDate
 * @return Array
 */
 public function getDaysByPeriod(DateTime $startDate, DateTime $endDate) {

 $startDt = clone $startDate;

 $days = array();

 while ( $startDt-&gt;format('U') &lt;= $endDt-&gt;format('U') ) {
 $days[] = $startDt-&gt;format('Y-m-d');
 $startDt-&gt;modify(&quot;+1 days&quot;);
 }

 return $days;
 }
</pre>
</li>
<li><strong>get the difference between two dates</strong><span style="text-decoration: underline;"><br />
input</span>: <span style="text-decoration: underline;"><br />
</span>2009-04-14 10:08:35<br />
2009-04-15 10:10:35<br />
<span style="text-decoration: underline;"> output</span>: unix timestamp of the difference<br />
<span style="color: #339966;">* updated -&gt; thx Toni and David</span>
<pre class="brush: php; title: ; notranslate">
/**
 * get the difference between two dates
 *
 * @param date $firstTime
 * @param date $lastTime
 * @return integer
 */
public function timeDiff($firstTime,$lastTime)
{
 return strtotime($lastTime) - strtotime($firstTime);
}
</pre>
</li>
</ol>
<div class="shr-publisher-639"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/14/a-few-helpfull-php-date-methods/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Useful Propel criteria methods and constants</title>
		<link>http://www.devexp.eu/2009/04/06/useful-propel-criteria-methods-and-constants/</link>
		<comments>http://www.devexp.eu/2009/04/06/useful-propel-criteria-methods-and-constants/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:00:29 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[criteria]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=551</guid>
		<description><![CDATA[I&#8217;m working with criteria quite often lately and must say it is a handy way of query writing. The only problem I have with criteria is that I don&#8217;t seem to find a simple overview (list) of the most important &#8230; <a href="http://www.devexp.eu/2009/04/06/useful-propel-criteria-methods-and-constants/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I&#8217;m working with criteria quite often lately and must say it is a handy way of query writing. The only problem I have with criteria is that I don&#8217;t seem to find a simple overview (list) of the most important methods you can add to it. I don&#8217;t really like the <a href="http://propel.phpdb.org/trac/" target="_blank">Propel website</a> as I don&#8217;t find the thing I need in a few seconds and that is a must for a lot of people. If I create a list of the most important criteria methods for myself, I rather share it with you guys&#8230;</p>
<p><strong>Simple Select query </strong>with 2 criteria to check:</p>
<pre class="brush: php; title: ; notranslate">
$c = new Criteria();
$c-&gt;add(AuthorPeer::FIRST_NAME, &quot;Karl&quot;);
$c-&gt;add(AuthorPeer::LAST_NAME, &quot;Marx&quot;, Criteria::NOT_EQUAL);
$authors = AuthorPeer::doSelect($c);
// $authors contains array of Author objects
</pre>
<p>In SQL this will be:</p>
<pre class="brush: php; title: ; notranslate">SELECT ... FROM author WHERE author.FIRST_NAME = 'Karl' AND author.LAST_NAME &lt;&gt; 'Marx';</pre>
<p>It&#8217;s quite simple to write the criteria, the only thing needed to write them is a list of options.</p>
<p><span id="more-551"></span><strong>To add Or to the criteria</strong> that have to be checked write:</p>
<pre class="brush: php; title: ; notranslate">
$cton1 = $c-&gt;getNewCriterion(AuthorPeer::FIRST_NAME, 'Karl');
$cton2 = $c-&gt;getNewCriterion(AuthorPeer::LAST_NAME,  'Marx', Criteria:: NOT_EQUAL);

// combine them
$cton1-&gt;addOr($cton2);
</pre>
<p>In SQL this will be:</p>
<pre class="brush: php; title: ; notranslate">SELECT ... FROM author WHERE author.FIRST_NAME = 'Karl' OR author.LAST_NAME &lt;&gt; 'Marx';</pre>
<p>Quite simple isn&#8217;t it, and the usage of criteria is quite readable once you start knowing all the options.</p>
<p>Possible operators for criteria (write them like Criteria::Equals)</p>
<ul type="disc">
<li>EQUAL (default)</li>
<li>NOT_EQUAL</li>
<li>GREATER_THAN</li>
<li>LESS_THAN</li>
<li>GREATER_EQUAL</li>
<li>LESS_EQUAL</li>
<li>LIKE</li>
<li>NOT_LIKE</li>
<li>IN</li>
<li>CUSTOM</li>
</ul>
<p>This allows you to write your own condition as second parameter.</p>
<ul type="disc">
<li>CUSTOM_EQUAL</li>
</ul>
<p>This is used to write a custom condition in an UPDATE query</p>
<ul type="disc">
<li>ISNULL</li>
<li>ISNOTNULL</li>
</ul>
<p>For some methods you need to add a line to the criteria to specify if they have to be used or not:</p>
<p><strong>$c-&gt;setIgnoreCase</strong>(true);<br />
This is to specify if the query should be case sensitive or not.</p>
<p><strong>$c-&gt;addJoin</strong>(ReviewPeer::BOOK_ID, BookPeer::ID, Criteria::INNER_JOIN);<br />
INNER JOIN (default) the table in parameter 1 to the table in parameter 2. In the same way you can RIGHT or LEFT JOIN.</p>
<p><strong>$c-&gt;addAscendingOrder</strong>ByColumn(table::column);<br />
This will add an ascending order for the specified column. Off course you can to the opposite too by using addDescendingOrderByColumn.</p>
<p><strong>$criteria-&gt;addSelectColumn</strong>(self::LABEL);<br />
This will add only this column to the select statement, by default he selects all fields of a table (default *)</p>
<p>All info about the methods and constants of criteria can be found <a href="http://propel.phpdb.org/docs/api/1.3/runtime/propel-util/Criteria.html" target="_blank">here</a>.</p>
<div class="shr-publisher-551"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/06/useful-propel-criteria-methods-and-constants/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Interesting People &#8211; part 1: Fabien Potencier</title>
		<link>http://www.devexp.eu/2009/04/04/interesting-people-part-1-fabien-potencier/</link>
		<comments>http://www.devexp.eu/2009/04/04/interesting-people-part-1-fabien-potencier/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 09:03:21 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[fabien Potencier]]></category>
		<category><![CDATA[lead developer]]></category>
		<category><![CDATA[sensio]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=543</guid>
		<description><![CDATA[Nothing better to get inspiration from then a nice cup of Nespresso in the evening. We are working with Symfony for a few months (years) now and I was wondering earlier this day: Who are the guys that are able &#8230; <a href="http://www.devexp.eu/2009/04/04/interesting-people-part-1-fabien-potencier/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><img class="alignright" style="border: 0pt none; margin: 5px;" title="Fabien Potencier" src="http://it-republik.de/konferenzen/rueckblick/php/ipc2007/images/2352.jpg" alt="Fabien Potencier" width="130" height="160" />Nothing better to get inspiration from then a nice cup of Nespresso in the evening. We are working with Symfony for a few months (years) now and I was wondering earlier this day: Who are the guys that are able to produce such a nice piece of software? You got to admit it that the framework these guys created is a masterpiece, must be a shitload of work and it is still growing on a daily basis.</p>
<p>Off course there is more then one person creating this software, but 1 man in particular is leading this project: Fabien Potencier.</p>
<p><span id="more-543"></span>A little history:</p>
<p>1994 to 1997  Fabien went to the Ecole National Supérieure des Mines de Nancy.<br />
1997 to 1998  Added master entrepreneur at HEC School of Management to his curriculum vitae.</p>
<p>In June 1998 Fabien and Grégory Pascal created there own little company called Sensio in France, an office was created in Canada and the United States. In October 2005 the Symfony framework was licensed and two years later the first version was launched.</p>
<p>A little list of history of Symfony:</p>
<blockquote><p>10/2005:            launch of the Symfony framework licence under MIT</p>
<p>11/2005:            Support integration of Ajax</p>
<p>12/2005:            Launch of the Askeet tutorial</p>
<p>08/2006:            Announcement of the first version</p>
<p>10/2006:            Announcement of the implication of Yahoo! Inc. in the framework and launch of the Yahoo! Bookmarks in Symfony</p>
<p>01/2007:            The definitive guide to Symfony is for sale as a paperback</p>
<p>02/2007:            The first version 1.0 is launched</p>
<p>09/2007:            The first exclusive conference takes place, SymfonyCamp in Holland</p>
<p>07/2008:            Yahoo! Launches the new version of delicious in Symfony</p></blockquote>
<p>Fabien launched his new book recently at the end of 2008, Practical Symfony and is actually an updated version of the first book, the definitive guide to Symfony.</p>
<p>Just like the first website Askeet, a new site was launched with the updates and new technologies, described in the second book, called: Jobeet.</p>
<p>This gives you an easy walkthrough for Symfony in 24 days and is the best way to understand and learn the structure and class system.</p>
<p>I know that this isn&#8217;t a full biography of Fabien Potencier but it will give you an idea of what he created and the work he is doing.</p>
<p>Follow Symfony the next few year, it has a great future&#8230; at least that is what I think.</p>
<div class="shr-publisher-543"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/04/04/interesting-people-part-1-fabien-potencier/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Symfony Forms Framework: Merge 2 forms</title>
		<link>http://www.devexp.eu/2009/03/19/symfony-forms-framework-merge-2-forms/</link>
		<comments>http://www.devexp.eu/2009/03/19/symfony-forms-framework-merge-2-forms/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 11:02:22 +0000</pubDate>
		<dc:creator>Van de Voorde Toni</dc:creator>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=462</guid>
		<description><![CDATA[Recently I had to create a form to create/update users in our system. Some time ago we decided to save are users in 2 tables. The first table would contain all login information and the second his personal information. This &#8230; <a href="http://www.devexp.eu/2009/03/19/symfony-forms-framework-merge-2-forms/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Recently I had to create a form to create/update users in our system. Some time ago we decided to save are users in 2 tables. The first table would contain all login information and the second his personal information. This is a simple example of the DB design:</p>
<div id="attachment_463" class="wp-caption aligncenter" style="width: 498px"><img class="size-full wp-image-463" title="User db design" src="http://www.devexp.eu/wp-content/uploads/2009/03/dbdesign.png" alt="User db design" width="488" height="168" /><p class="wp-caption-text">User db design</p></div>
<p>I would not recommend doing this for so little fields. But in our system we have a lot more fields, and it helps us to optimize our queries.</p>
<p>Wouldn&#8217;t it be better if we could merge the 2 forms? The answer is yes. And it&#8217;s pretty easy to do so in Symfony &#8230; too bad that it’s not documented on the Symfony website.</p>
<p><span id="more-462"></span></p>
<p>When you generate the forms with Symfony, you’ll get a UserForm and a UserInfoForm.</p>
<pre class="brush: php; title: ; notranslate">/**
* User form.
*
* @package    form
*/
class UserForm extends BaseUserForm {

public function configure() {

}

}

/**
* UserInfo form.
*
* @package    form
*/
class UserInfoForm extends BaseUserInfoForm {

public function configure() {

}

}</pre>
<p>The idea is to display one form to insert/update those 2 tables. If you are familiar to creating forms with Symfony you know that you could achieve it by instantiating the 2 forms in an action and send them to the templates:</p>
<pre class="brush: php; title: ; notranslate">
/**
* Action Class
*/
class userActions extends sfActions
{
public function executeCreate($request) {
$this-&gt;userForm = new UserForm();
$this-&gt;userInfoForm = new UserInfoForm();
$this-&gt;setTemplate('edit');
}

public function executeEdit($request) {
$this-&gt;userForm = new UserForm(UserPeer::retrieveByPK($request-&gt;getParameter('id')));
$this-&gt;userInfoForm = new UserInfoForm(UserInfoPeer::retrieveByPK($request-&gt;getParameter('id')));
}

public function executeUpdate($request) {
$this-&gt;userForm = new UserForm(UserPeer::retrieveByPK($request-&gt;getParameter('id')));
$this-&gt;userInfoForm = new UserInfoForm(UserInfoPeer::retrieveByPK($request-&gt;getParameter('id')));

$this-&gt;userForm-&gt;bind($request-&gt;getParameter($this-&gt;userForm-&gt;getName()));
$this-&gt;userInfoForm-&gt;bind($request-&gt;getParameter($this-&gt;userInfoForm-&gt;getName()));

// etc ...
}
}

// Template code editSuccess.php
&lt;?php $user = $userForm-&gt;getObject(); ?&gt;

&lt;form action=&quot;&lt;?php echo url_for('user/update'.(!$user-&gt;isNew() ? '?id='.$user-&gt;getId() : '')) ?&gt;&quot; method=&quot;post&quot;&gt;
&lt;table&gt;
&lt;tfoot&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;
&lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;tbody&gt;
&lt;?php echo $userForm ?&gt;
&lt;?php echo $userInfoForm ?&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/form&gt;
</pre>
<p>This is really annoying to work this way. You always have to instance 2 forms in the action and the templates. Wouldn&#8217;t it be better if we could merge the 2 forms? The answer is yes. And it&#8217;s pretty easy to do so in Symfony &#8230; too bad that it’s not documented on the Symfony website.</p>
<p>Here is how you do it:</p>
<p><span style="text-decoration: underline;"><strong>1. UserForm.class.php</strong></span></p>
<pre class="brush: php; title: ; notranslate">/**
* User form.
*
* @package    form
*/
class UserForm extends BaseUserForm {

public function configure() {
$this-&gt;mergeForm(new UserInfoForm(UserInfoPeer::retrieveByPK($this-&gt;getObject()-&gt;getId())));
}

/**
* Override the save method to save the merged user info form.
*/
public function save($con = null) {
parent::save();

$this-&gt;updateUserInfo();

return $this-&gt;object;
}

/**
* Updates the user info merged form.
*/
protected function updateUserInfo() {
// update user info
if (!is_null($userInfo = $this-&gt;getUserInfo())) {

$values = $this-&gt;getValues();
if ( $userInfo-&gt;isNew() ) {
$values['user_id'] = $this-&gt;object-&gt;getId();
}

$userInfo-&gt;fromArray($values, BasePeer::TYPE_FIELDNAME);

$userInfo-&gt;save();
}
}

/**
* Returns the user info object. If it does
* not exist return a new instance.
*
* @return UserInfo
*/
protected function getUserInfo() {

if (!$this-&gt;object-&gt;getUserInfo()) {
return new UserInfo();
}

return $this-&gt;object-&gt;getUserInfo();
}
}
</pre>
<p><span style="text-decoration: underline;"><strong>2. actions.class.php</strong></span></p>
<pre class="brush: php; title: ; notranslate">
public function executeCreate($request) {
$this-&gt;form = new UserForm();
$this-&gt;setTemplate('edit');
}

public function executeEdit($request) {
$this-&gt;form = new UserForm(UserPeer::retrieveByPK($request-&gt;getParameter('id')));
}

public function executeUpdate($request) {

$this-&gt;forward404Unless($request-&gt;isMethod('post'));

$this-&gt;form = new UserForm(UserPeer::retrieveByPK($request-&gt;getParameter('id')));

$this-&gt;form-&gt;bind($request-&gt;getParameter($this-&gt;form-&gt;getName()));
if ($this-&gt;form-&gt;isValid()) {
$user = $this-&gt;form-&gt;save();
$this-&gt;redirect('user/edit?id='.$user-&gt;getId());
}

$this-&gt;setTemplate('edit');
}
</pre>
<p><span style="text-decoration: underline;"><strong>3. editSuccess.php</strong></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $user = $userForm-&gt;getObject(); ?&gt;

&lt;form action=&quot;&lt;?php echo url_for('user/update'.(!$user-&gt;isNew() ? '?id='.$user-&gt;getId() : '')) ?&gt;&quot; method=&quot;post&quot;&gt;
&lt;table&gt;
&lt;tfoot&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;
&lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;tbody&gt;
&lt;?php echo $userForm ?&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/form&gt;
</pre>
<p>As you can see, it’s the UserForm that will handle all the business of the UserInfoForm. This is great because the code in the action and template will be much more lightened and if needed it can easily be reused somewhere else.</p>
<p>This was a simple example on how to merge 2 forms, but since it&#8217;s not documented on the symfony website, it took me some time to fully understand on how to make it work. Now you can do much more advanced operations. <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="shr-publisher-462"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/03/19/symfony-forms-framework-merge-2-forms/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>enhance your css</title>
		<link>http://www.devexp.eu/2009/03/19/enhance-your-css/</link>
		<comments>http://www.devexp.eu/2009/03/19/enhance-your-css/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 08:43:29 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[alphabetize]]></category>
		<category><![CDATA[clean]]></category>
		<category><![CDATA[enhance]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=445</guid>
		<description><![CDATA[Writing css code isn&#8217;t that hard, it&#8217;s easy, clean but can be a pain in the ass to keep it readable when you have hundreds or maybe thousands of lines of code. When sticking to specific rules it can all &#8230; <a href="http://www.devexp.eu/2009/03/19/enhance-your-css/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Writing css code isn&#8217;t that hard, it&#8217;s easy, clean but can be a pain in the ass to keep it readable when you have hundreds or maybe thousands of lines of code.</p>
<p>When sticking to specific rules it can all be made a bit more readable:</p>
<ul>
<li>always use a reset of some sort</li>
<li>alphabetize</li>
<li>write comment</li>
<li>consistency</li>
<li>start in the right place</li>
<li>Understanding Class and ID</li>
<li>Power of li</li>
<li>CSS Debugging Tools</li>
</ul>
<p>read the full text to enhance your css code</p>
<h5>5 Ways to Instantly Write Better CSS (click <a href="http://net.tutsplus.com/tutorials/html-css-techniques/5-tips-to-writing-better-css/" target="_blank">here </a>)</h5>
<h5>20 Useful CSS Tips (click <a href="http://www.hongkiat.com/blog/20-useful-css-tips-for-beginners/" target="_blank">here)</a></h5>
<div class="shr-publisher-445"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/03/19/enhance-your-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

