[Templates] Template Tookit Vs HTML::Template
Leo Lapworth
Leo Lapworth <leo@cuckoo.org>
Fri, 15 Nov 2002 13:23:45 +0000
On Fri, Nov 15, 2002 at 01:05:54PM +0000, Rafiq Ismail (ADMIN) wrote:
> I have to provide sound arguments as to why our prospective new system
> shouldn't move away from TT2 and use HTML::Template instead.
Just some pointers:
http://www.perl.com/pub/a/2001/08/21/templating.html
I wrote this ages ago, it's not very good but might be
of some help.
http://leo.cuckoo.org/projects/template_systems.shtml
- reading through that there are a few mistakes, e.g.
TT can HTML encode data.
A couple of general things:
Speed
-----
TT2 is fast - if your using the C compiled version of the Stash,
you get this option when you install it.
TT2 is very fast if you use it under mod_perl and share
your TT object between processes.
It might not be as fast as HTML::Template in some situations
but hardware is cheep and I've always found HTML::Template
far to limiting for all but the basic of systems, with
TT you know you can expand functionality / complexity
later if it's needed.
Control
-------
With any system designers can make your life hell, when ever
I've introduced TT to designers they've loved it, it stops
me having to write 101 little things in the code that should
be in the template. You'll still need to support them, but
as long as you start by teaching them good practices and
providing them with a list of plugins / methods that should
be used as default they won't go reinventing the wheel.
We use standards like
[% form_input.X %] will always be what the user has just
submitted in the previous form, this way the designers
need very little instruction from us as to how to access
that information.
We have a set of Plugins to format dates, chop and upper
case strings.
We NEVER allow perl blocks
Anyway, hope that's of some help.
Leo