Re: Leaving tmp_var intact inside template
Michael Peters <[email protected]> Mon, 28 Jul 2008 17:13:58 -0400
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <[email protected]> |
city crew wrote: > 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. We do something similar to your #2. We use a slightly more obvious syntax though. We use <TMPL_VAR> for things that are being loaded on the first pass and <DYN_VAR> for things on the 2nd pass. Just FYI, I've heard this technique named a couple of different things, in case you want to impress anyone :) It's usually called "2 pass templating" or "Write-thru cache templating". -- Michael Peters Plus Three, LP ------------------------------------------------------------------------- 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=/