Re: [htmltmpl] Coding up a three column table...
Brought to you by:
samtregar
From: Mathew R. <mat...@re...> - 2004-05-12 23:09:09
|
if you are using H::T::E you can leave your output formatting to the = template, and leave your Perl code as a single loop (with no embedded = loops). eg: my @loop; for ... { push @loop, something; } $t->param(loop =3D> \@loop); <!-- want 3 columns --> <table ...> <TMPL_LOOP loop> <TMPL_IF EXPR=3D"(__counter % 3) =3D=3D 1"> <tr> </TMPL_IF> <td> <TMPL_VAR blah> </td> <TMPL_IF EXPR=3D"(__counter % 3) =3D=3D 0"> </tr> </TMPL_IF> </TMPL_LOOP> </table> In this example, the formatting out the HTML is completly in the hands = of the template -> the Perl code need not know anything about how the = array will get displayed. Mathew PS. I use it to make a 3-column display of an image gallery - = http://www.lrautomotive.com.au/gallery.html > I've got an image gallery that I want displayed as three columns. >=20 > Am I right in assuming that I need to code it up as an array of rows > containing the array of the column cells? >=20 > Anyone got any nice idiomatic perl for transforming a simple array > into one of these? ;-) >=20 > Ta, >=20 > Dave >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to=20 > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=3Dosdnemail3 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |