11th Jan 2006

Posted in

Blog :: Tech roundup

Random bits of wisdom and link roundup for the day:

The wforms javascript library doesn't get nearly the Web2.0 buzz that javascript frameworks like prototype, scriptaculous, dojo, etc do. Still, for actual drop in integration, it's hard to beat unobtrusive Javascript. I set up Steven Greydanus' film review site decentfilms.com a while ago and have since been too busy to do much maintenance to it. Recently he asked me to add some validation to the contact form. The problem is that the form generator/editor in blueCMS is pretty much junk right now. It doesn't support any validation (besides required elements). I do have a complete rewrite about half done that will be much better, but in the meantime I'm reluctant to extend the old codebase. The solution for Steven's problem for the moment was to use wform's validation: simply include the javascript library and then set appropriate classes on appropriate elements ('like class="validate-email"). Wforms is unobtrusive javascript: it handles the rest automatically for me and I don't have to write a line of code... Good Stuff!

I mentioned recently that some of my frustration lately was due to maintaining other people's code. Some of it, unfortunately, was due to my own technology choices. I'll have an extensive writeup of some QuickForm/Rendering/Template issues I've been struggling with lately, but in the meantime may I say that if you're going to use PEAR libs, Flexy is the only sane templating choice. I've tended to use Sigma templates (because back in the day I used phplib templates) because (I argued) it's better not to embed logic in the templates that the creatives will be editing...) This is wrong on a whole variety of levels, not least that whether you indicate template loops via html comments (as in sigma) or by flexy:foreach as in flexy, you still have logic in the template. One of these ways, however, produces verbose templates that violate the DRY rule badly (with Sigma you typically have your html element that will loop: say a <tr>, your html comment that indicates the loop, and then you still have to explicitly parse loops in the php code driving the template. Yuck.) Additionally, Flexy provides some nice features like auto escaping variables, and using xml namespace notation on attributes to keep your uncompiled templates mostly viewable in the browser.

Now I might mention that the documentation for Flexy leaves something to be desired (can we convert pear.php.net to wiki format already?). No mention of the flexy:raw (very needed!) There are also some missing features: I'd love to have Kid's replace feature, but on the whole, very useable. I've got some simple flexy howto stuff here, and I'll have more to say about this later.

Posted on Jan 11th 2006, 12:38 AM