I come down firmly in favor of keeping code out of templates.
The project I'm on now assembles HTML hierarchically, using HTML::Template-based fragements to assemble larger pages. This lets us build reusable components while still keeping our HTML separated from our code. Consider something like:
<h1>Here somes a table</h1> <TMPL_VAR NAME=table ESCAPE=0> <hr>
On first glance, you might assume that table is a chunk of HTML table tags generated from code, but nothing says that it can't be the result of expanding a different template and stored the resulting HTML in a hash that gets used when constructing arguments for the outer template.
In reply to Re: Code and html separation - always or mostly doable?
by dws
in thread Code and html separation - always or mostly doable?
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |