Hi,

I would like to automatically wrap a template in a header and footer without having to specify <TMPL_INCLUDE [header|footer].tmpl> for every page. In TT I can use the PRE_PROCESS and POST_PROCESS options, which specify a template that is pre/appended to the specified template. Is there an easy way to automatically do this in HTML::Template?

It looks like I can do this with a filter, but it doesn't feel right to me.

my $filter = sub {
my $text = shift;
unshift @$text, "<TMPL_INCLUDE header.tmpl>";
push @$text, "<TMPL_INCLUDE footer.tmpl>";
}
my $template = HTML::Template->new('file.tmpl',filter=>{sub=>$filter,format=>'array'});

Drew
--
Drew Taylor | Web development & consulting
http://www.drewtaylor.com/ | perl/mod_perl/DBI/mysql/postgres
----------------------------------------------------------------------
"If you don't know what your program is supposed to do,
you'd better not start writing it." -Edsger Dijkstra
----------------------------------------------------------------------
Speakeasy.net DSL - http://www.speakeasy.net/refer/29655



-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about your web server security? Click here for a FREE Thawte Apache SSL Guide and answer your Apache SSL security needs: http://www.gothawte.com/rd523.html
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to