[Web-SIG] HTMLTemplate
Jonathan Ellis
jonathan at carnageblender.com
Fri Jun 3 00:56:43 CEST 2005
On Thu, 2 Jun 2005 18:42:47 -0400 (EDT), "mike bayer"
<mike_mp at zzzcomputing.com> said:
>
> referring to this one:
>
> http://freespace.virgin.net/hamish.sanderson/htmltemplate.html
>
> it looks very cool and elegant, and clearly produces templates that are
> super-clean. however, I would wonder how convenient it really is to
> create 100% of all the programmatically generated content in your
> "controller" module, including even the most trivial concatenation of
> strings. I would think that for a complicated page design with alot of
> data embedded in it, this would lead to a much bigger mess of HTML mixed
> with code in the controller class than the one it seeks to prevent in the
> HTML template.
Hmm...
The idea in a template system is, the model provides the data and the
template interpolates it. So in this case, the template engine takes
the template
<li node="rep:item">
<a href="" node="con:link">LINK</a>
</li>
and a Python list and combines them to give
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="products/index.html">Products</a>
</li>
<li>
<a href="about.html">About</a>
</li>
No manual concatenation is involved.
The callback organization is interesting but seems more cumbersome than
the more-traditional approach you see in Cheetah et al. I guess if you
are absolutely allergic to any sort of code whatsoever in your
presentation layer, though, HTMLTemplate might be the way to go. :)
-Jonathan
More information about the Web-SIG
mailing list