On Wed, May 12, 2004 at 10:05:03AM +0100, Dave Hodgkinson wrote:
>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?

No, but that's one way to do it. Another, and what I'd do if I were
feeling lazy, would be to use a single level of loop with extensions,
something like:

<table>
<tmpl_loop name=stuff>
<tmpl_if name=colstart>
  <tr>
</tmpl_if>
<td>your_content_here</td>
<tmpl_if name=colend>
  </tr>
</tmpl_if>
</tmpl_loop>
</table>

and just poke colstart and colend in the right place.

>Anyone got any nice idiomatic perl for transforming a simple array
>into one of these? ;-)

# generate @content with the image names and so on
for (my $n=0;$n<=$#content;$n+=3) {
  $content[$n]{colstart}=1;
}
for (my $n=2;$n<=$#content;$n+=3) {
  $content[$n]{colend}=1;
}
$content[-1]{colend}=1;

(warning, totally untested, but it probably works)

Roger


-------------------------------------------------------
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
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to