[Belfast-pm] Template Toolkit, passing in a hash?

Simon McCartney simon at thebreakfasttable.com
Tue Jul 6 04:21:39 CDT 2004


I've been playing with TT on Debian, I've used it to prototype some stuff
using DBI calls in the template, but I want to move to the next level.
(I'm using Apache, MySQL & have the handler registered etc)

I have a couple of routines that generate a hash of information, and I want
to display these in the processed template.

My understanding is that I would pass the hash in using $vars in the
process method. But this means that the calculations take place for every
page served by that handler, hardly efficient.

My next option would be to pass the subroutine in and only call it when
needed in the template.  But this means changing my handler everytime I
want to add a new subroutine to the module.

Is there a better way? Am I missing something?
I guess I want to be able to use it as a plugin without writing a
plugin..is a plugin the correct way to go?

Thanks,

Simon.

-- 
Simon McCartney
simon at thebreakfasttable.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/belfast-pm/attachments/20040706/08ae4f62/attachment.bin


More information about the Belfast-pm mailing list