in reply to Alternate template syntax for HTML::Template?
You are looking for the 'filter' parameter to new.
From the documentation:
my $filter = sub { my $text_ref = shift; $$text_ref =~ s/!!!ZAP_(.*?)!!!/<TMPL_$1>/g; }; # open zap.tmpl using the above filter my $template = HTML::Template->new( filename => 'zap.tmpl', filter => $filter);
You would then be able to use !!!VAR name="whatever"!!! Personaly though i like something along the lines of:
sub convert { my $text_ref = shift; $$text_ref =~ s/\[\%=(.*?)\%\]/<TMPL_VAR NAME=$1>/g; $$text_ref =~ s/\[\%\/(.*?)\%\]/<\/TMPL_$1>/g; $$text_ref =~ s/\[\%(.*?)\%\]/<TMPL_$1>/g; }
This lets me to [%=name%] and [%if name%] [%/if%] which i like more than the default.
Edit by castaway - fixed code tags
|
---|