Re: [htmltmpl] Coding up a three column table...
Brought to you by:
samtregar
From: Carl F. <ca...@fi...> - 2004-05-12 09:42:50
|
One way to do it might be: use strict; use Data::Dumper; my $cols = 3; my @foo = ({one => 1, ein => 1}, {two => 2, zwei => 2}, {three => 3, drei => 3}, {four => 4, vier => 4}); my @bar; for (my $n=0; $n<=$#foo; $n+=$cols) { my @row; for (1..$cols) { push @row, $foo[$n+($_-1)] if $foo[$n+($_-1)]; } push @bar, \@row; } $t->param (loop => \@bar); While not very pretty, it does have a configurable number of columns. Carl > > I've got an image gallery that I want displayed as three columns. > > Am I right in assuming that I need to code it up as an array of rows > containing the array of the column cells? > > Anyone got any nice idiomatic perl for transforming a simple array > into one of these? ;-) > > Ta, > > Dave > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > |