Thread Problem mit MicroMason (18 answers)
Opened by kabel at 2003-09-14 21:14

Strat
 2003-09-15 01:10
#28059 #28059
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
in perldoc HTML::Template steht:
Quote
TMPL_LOOP
<TMPL_LOOP NAME="LOOP_NAME"> ... </TMPL_LOOP>

The <TMPL_LOOP> tag is a bit more complicated than <TMPL_VAR>. The
<TMPL_LOOP> tag allows you to delimit a section of text and give it a
name. Inside this named loop you place <TMPL_VAR>s. Now you pass to
param() a list (an array ref) of parameter assignments (hash refs) for
this loop. The loop iterates over the list and produces output from the
text block for each pass. Unset parameters are skipped. Here's an
example:

In the template:

<TMPL_LOOP NAME=EMPLOYEE_INFO>
Name: <TMPL_VAR NAME=NAME> <br>
Job: <TMPL_VAR NAME=JOB> <p>
</TMPL_LOOP>

In the script:

$template->param(EMPLOYEE_INFO => [
{ name => 'Sam', job => 'programmer'
},
{ name => 'Steve', job => 'soda jerk'
},
]
);
print $template->output();
...
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/

View full thread Problem mit MicroMason