Archive > Date > April, 2009
Symfony is one of my favourite bits of technology. I’ve got plans to write several articles and tutorials on it, but as I know many people haven’t yet heard of it, or are unaware of how it could help them, I thought it best to write an introductory article. So, here is an explanation of what Symfony is, why I use it, and why you may want to start using it too.
Two weeks ago, my slightly better half had his 30th birthday. To celebrate him becoming a “proper” adult, I decided there was nothing more fitting than a visit to Disneyland. So on Monday we’re flying to Florida for three weeks of tomfoolery in Orlando.
By default Symfony displays forms in tables, with each new input being a table row. If you want to display your forms more semantically with fieldsets and lists, Symfony has a list formatter built in. You can tell an individual form to display as a list using the code below.
1 2 3 4 5 6 | <?php // lib/form/MyModelForm.class.php public function configure() { $this->widgetSchema->setFormFormatterName('list'); } ?> |
There has been much talk in the web design and development community of late regarding the demise of Internet Explorer 6. Most web developers and designers have a special place in their hearts for their hatred of IE6, but the strength of their loathing varies from the occasional moaning, to the t-shirt wearing, to those running campaigns of contempt (see IE Death March, Bring Down IE 6 or Stop Living in the Past).
Personally, I strongly disagree with those who say web folk should stop supporting IE6 now, that we should use special stylesheets to make sites look particularly ugly in IE6, or more worryingly that scripts should be used to prevent sites from working in IE6 at all. It is the job of a web developer to support all major browsers (of which IE6 is still one) and punishing unwitting users is not the solution. It is Microsoft’s job to cease support of this ancient and incapable technology not ours.
I often forget how to set default values for form fields. Mainly because it’s a function of sfForm rather than sfFormField I think. I the snippet below ‘field’ you are setting the default value for, and $value should be the default value.
1 | $this->setDefault('field', $value); |
The following snippets provide access to the Symfony User object from various parts of a Symfony project.
Place this line of code in the configure method of a Symfony form to allow the saving of additional fields.
1 2 3 4 5 6 | <?php // lib/form/MyModelForm.class.php public function configure() { $this->validatorSchema->setOption('allow_extra_fields', true); } ?> |
Last night this article hit the front page of Digg. Written by Thomas Hardy over at Web Designer Help, it’s a showcase on the top 30 web folk to follow on twitter, in which I was included.
I had no idea that the article had been written or that I was in it, so imagine [...]
Following in the tradition of new beginnings that comes with the arrival of Spring, I’ve launched my blog. Please help yourself to a Pimms & Lemonade, find yourself a warm spot on my decking, and make yourself comfortable whilst I explain a little of what this blog is for.











