Re: [htmltmpl] New Template Object based on Existing one
Brought to you by:
samtregar
From: Chris F. <cf...@do...> - 2004-02-09 15:11:56
|
Roger Burton West wrote: > I haven't tried this, but my first reaction is to use the usual syntax > for interrogating a template: > > $content2->param($content->param); Sébastien Aperghis-Tramoni wrote: > It's even simpler: simply associate the first object with the second. > #!/usr/bin/perl > use HTML::Template; > my $tmpl = new HTML::Template filehandle => \*DATA; > $tmpl->param(foo => "bar"); > print $tmpl->output; > my $str = "Second template: foo = <TMPL_VAR NAME=foo>\n"; > my $copy = new HTML::Template scalarref => \$str, associate => $tmpl; > print $copy->output; Thanks for the suggestions guys, I tried both ways and I got different results with each. That "associate" seemed like the way to go, when I tried that I get the H:T error "attempt to set parameter 'items_loop' with a scalar - parameter is not a TMPL_VAR!" When I tried the "$content2->param($content->param);" method - I'm not really sure what happened, it failed when trying to set a tmpl_var that was the "else" in $content, but $content already contained the flag to mark that value true, plus it seemed to process forever, it took about 2 mins.. I'm going to keep experimenting and see if I can get something to work, if you have any other idea, I'd love to hear them. Thanks -Chris |