[nycphp-talk] Smarty Templates
David Mintz
dmintz at davidmintz.org
Wed Nov 2 14:39:37 EST 2005
I've noticed that if you use e.g. HTML_QuickForm (a Good Thing, IMHO) then
you eventually find yourself almost coerced into getting involved in
Smarty (or some other template engine), because QF's default renderer is
just adequate for the simplest of display tasks, and customizing it
heavily is really tedious. OTOH your Smarty templates end up looking like
{if $form.lastname.error}
<tr><td> </td><td>{$form.lastname.error}</td></tr>
{/if}
<tr><td class="label">
<label for="lastname">Last name</label>
</td>
<td>{$form.lastname.html}</td></tr>
which about as ugly as the other alternatives. Still, I think it's worth
it. I have taken to sticking the form initialization work into the same
classes that do the db access work. The result is that the PHP scripts
that control the flow end up being short and sweet.
---
David Mintz
http://davidmintz.org/
More information about the talk
mailing list