in reply to Browser-viewable HTML::Template templates
Yuck. If you have to synchronize the template with the code, why use a template at all?
If you ask me, the best solution is to switch to Template Toolkit 2 and do something like this:
And you can also change the tag delimiters so that you can make it look f.ex like so:[% IF foo_checked ; '<input type=checkbox name="foo" checked>' ; ELSE +-%] <input type=checkbox name="foo">[% END %]
That way the browser sees valid HTML and the template can still generate either variant. HTML::Template ain't bad, but its syntax is really too restrictive IMHO.<!--// IF foo_checked ; '<input type=checkbox name="foo" checked>' ; E +LSE --> <input type=checkbox name="foo"><!--// END -->
Makeshifts last the longest.
|
|---|