da hat wohl jemand die doku falsch verstanden.
Quote<TMPL_IF> </TMPL_IF> blocks can include any valid HTML::Template construct - VARs and LOOPs and other IF/ELSE blocks. Note, however, that intersecting a <TMPL_IF> and a <TMPL_LOOP> is invalid.
Not going to work:
<TMPL_IF BOOL>
<TMPL_LOOP SOME_LOOP>
</TMPL_IF>
</TMPL_LOOP>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
kabel@linux:~/progs/perl> cat html_template.pl
use strict;
use HTML::Template;
my $t_text = q~
<TMPL_IF NAME="BOOL">
<TMPL_LOOP NAME=PERSONS>
name: <TMPL_VAR NAME=name>
age : <TMPL_VAR NAME=age>
</TMPL_LOOP>
</TMPL_IF>
~;
my $t = HTML::Template->new (scalarref => \$t_text);
$t->param (BOOL => 1);
$t->param (PERSONS => [
{ name => "kabel", age => "22" },
{ name => "chef", age => "22" },
]);
print STDOUT $t->output ();
kabel@linux:~/progs/perl> perl -w html_template.pl
name: kabel
age : 22
name: chef
age : 22
kabel@linux:~/progs/perl>
-- stefan