On Wed, 23 May 2001, Mirek Rewak wrote:
> I'm staring with Template-Toolkit and so far I'm very excited of this
> module. I want to use it to build my web application (cgi based
> e-shop). Every page will consist of few sub elements which will be
> genereated by different scripts (eg. results of query and dynamic
> picture)
Do you mean you want to daisy chain a bunch of scripts or something? That
would appear a bit of a nasty way to do things.
The nicest way to do it would be to have handlers for each section which
share a "page" object, with the handlers called from a single script,
which then passes the object (or hash) tothe template object which is
then processed.
something like :
use Template;
use strict;
...
foreach $element (@elements)
{eval " use ".$element."_handler;"; ... # do stuff with element }
then put
[% IF Page.ElementName %]
...
[% INCLUDE element.template %]
[% END %]
in your template.
That is probably over-engineering but it should scale fairly well, and I'm
sure somebody will correct me if I'm wrong.
HTH.
A.