in reply to HTML::Template generic includes
Your main template could look something like[% # THis is in templatelib.tt %] [% MACRO date_template(parm1, parm2, parm3) BLOCK %] [% SWITCH parm1 %] [% CASE "value 1" %] display this way [% CASE "value 2" %] display other way [% CASE DEFAULT %] display default way [% END %] [% END %]
your perl would look something like[% # this is foo.tt %] [% PROCESS templatelib.tt %] [% date_template(parm_from_script, "foo", "bar") %]
Granted, there is now "code" inside the html, but it's still all display logic. It's not the processing logic. I tend to make the line between perl/templates in that perl will handle anything that's not strictly for display while the templates will handle everything else. People disagree with this and they're right too. :Pmy $template = Template->new(); my $t_vars = { parm_from_script => "value 1", other_stuff => "mmmm donuts", }; $template->process("foo.tt", $t_vars) || die $template->error();
|
|---|