I am creating a HTML template that I want populate only some of the variables
(TMPL_VARs) in it, then output it to a file that I will call again at a later
date to populate the rest of the variables. So basically I want to escape some
of the TMPL variables so they can be populated on the second pass.
eg.
<DIV>
<TMPL_VAR NAME="title_pass1">
<TMPL_VAR NAME="content_pass2">
<TMPL_VAR NAME="footer_pass1">
</DIV>
The only solutions i can think of is to set the second pass of vars to
<TMPL_VAR NAME=test> and either:
1. output the first pass to a file, then call the new template with the filter
param which converts all /<TMPL/<TMPL/g. I don't like this way as it has to
run a regexp subst on each template as it's loaded, and the second pass is the
one that is used more often, the first pass is just to create the structure for
the second pass.
2. store template output into a scalar and to a regexp subst on the scalar
before printint that to the file.
my $templateRef = $template->output;
$templateRef =~ s/<TMPL_/<TMPL_/g;
print TEMP $templateRef;
As I am writing this I think I'm going to go with solution 2 as it outputs the
file and doesn't require any filter on loading the second template.
Any feedback on this would be great though, otherwise maybe this might help
someone else who is looking for a similar solution.
Grant
_________________________________________________________________
Windows Live Messenger treats you to 30 free emoticons - Bees, cows, tigers and
more!
http://livelife.ninemsn.com.au/article.aspx?id=567534
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users