Thread HTML::Template Loop: ab x Mal wdh (15 answers)
Opened by pktm at 2004-07-27 01:24

esskar
 2004-12-17 02:10
#3247 #3247
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
das kannst du nicht im template sondern nur im script steuern

Code: (dl )
1
2
3
4
5
6
7
<TMPL_LOOP NAME="ROWS">
<tr>
<TMPL_LOOP NAME="COLS">
<td><img src="<TMPL_VAR NAME="IMAGESRC"> alt="" /></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $COLMAXITEM = 3;

my $idx = 0;
my @rows = ();
my $maxcount = scalar @item - 1;
foreach my $it (@item)
{
  push @cols, {IMAGESRC=> $it};
  if(scalar @cols == $COLMAXITEM or $idx+1 == $maxcount)
  {
     push @rows, {COLS => [@cols]};
     @cols = ();
  }
  $idx++;
}
\n\n

<!--EDIT|esskar|1103285063-->

View full thread HTML::Template Loop: ab x Mal wdh