Thread HTML::Template Loop in Loop (2 answers)
Opened by tomlong at 2004-03-03 22:06

esskar
 2004-03-03 22:16
#1399 #1399
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
annahme $tpl ist dein HTML::Template Object!

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my @mainloopdata = ();
foreach my $main (@mains)
{
my %mainhash = ();
$mainhash{MAIN} = $main->{MAIN};
my @subsloopdata = ();
foreach my subs (@{$main->{SUBS}})
{
my %subhash = ();
$subhash{SUBS} = $subs;
push @subsloopdata, \%subhash;
}
$mainhash{SUBLOOP} = \@subsloopdata;
push @mainloopdata , \%mainhash;
}
$tpl->param(MAINLOOP => \@mainloopdata);

View full thread HTML::Template Loop in Loop