in reply to Re: HTML::Template-2 on one
in thread HTML::Template-2 on one
I'd like to a add a piece of example code to what Cody Pendant said:
my $table_tmpl = new HTML::Template filename => 'table.tmpl'; my $result = new HTML::Template filename => 'comparison_page.tmpl' +; my ($first, $second); $table_tmpl->param(data => get_table_data(key => 'first')); $first = $table_tmpl->output; $table_tmpl->param(data => get_table_data(key => 'second')); $second = $table_tmpl->output; $result->param(first => $first, second => $second); print $result->output;
That's a common pattern -- to generate several pieces of HTML using one template and different data and then insert these pieces into final output template.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: HTML::Template-2 on one
by edan (Curate) on Nov 21, 2004 at 10:39 UTC | |
by kappa (Chaplain) on Nov 21, 2004 at 10:54 UTC | |
by edan (Curate) on Nov 21, 2004 at 11:30 UTC | |
by kappa (Chaplain) on Nov 21, 2004 at 11:53 UTC | |
by edan (Curate) on Nov 21, 2004 at 12:18 UTC |