Hi,all 

I have code using common "print" for html in a perl
script

my @keywords =qw(key_1 key_2 key_3);
print "Your search for <b>@keywords</b> has ...etc
\n";

now turning above code into a template using
HTML::Template, 

        in perl script
my @loop;
foreach (@keywords) {
        my %result;
        $result{'keyword'} = $_;
        push(@loop,\%result); 
}
$template->param('keywords' => \@loop);

        then in a tmpl file 
P>Your search for <b><TMPL_LOOP
NAME="keywords"><TMPL_VAR 
NAME="keyword"></tmpl_loop></b> found etc......

seems a lot extra codes than common "print" ... any
better idea writing it ?

One more question:

from the document,"
Basically, each <TMPL_LOOP> gets an array reference.
Inside the array are any number of hash references.
These hashes contain the name=>value pairs for a
single pass over the loop template." if i understand
correctly
Then for each <TMPL_LOOP> correspondingly i need to
creat a hash and an array.. hmmm, sounds some extra
variables i have to create..pretty much like the
previous question.. is it the only way to do it?

excuse me too many dumb questions. i am learning it :)

Reards,

Qiang


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to