in reply to HTML::Template-2 on one

I think this is a "please show your code" question.

I have to say I don't understand why you would think it wasn't possible.

I mean, here's the simplest possible example:

<html><head></head><body> <tmpl_var name="stufffromtableone"> <tmpl_var name="stufffromtabletwo"> </body></html>
And the perl would basically go:
$x = getstufffromtableone(); $y = getstufffromtabletwo(); $template->param( stufffromtableone => $x ); $template->param( stufffromtabletwo => $y );

So, if you know how to do that, the problem must be with some kind of data structure, loop etc.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re^2: HTML::Template-2 on one
by kappa (Chaplain) on Nov 21, 2004 at 10:15 UTC

    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.

      Your code suffers from the dreaded "Indirect Object Syntax" - something to avoid. In legacy code it can be excused, but not in example code.

      --
      edan

        Whoa, you are the first to call this beauty a dreaded thing :) Indirect Object Syntax is one of my favourite features of Perl! Why on Earth is it "dreaded"?