I have a question regarding the FOREACH loops. I have a FOREACH being used to loop through an array to insert various images into a table. Like this:

        
                [% FOREACH light IN lights %]
                        <td>
                <img src="[% light.light_red %]">
                <img src="[% light.light_yellow %]">
                <img src="[% light.light_green %]">
                <img src="[% light.light_blue %]">
                        </td>
                        
                [% END %]

What I need to do now is to loop through each element in the array (like a counter) and insert the images into it's own table. Like this:

FOR a <= 3
        <table>
        <tr>
                <td>
        <img src="[% light.[$a] %]">
                </td>
        </tr>     
        </table>
a= a++
NEXT

The problem is I don't know how to tell it the number of elements in the array (in this instance it will always be 4).

Keep in mind that this code is inside an HTML template, so I don't really want any perl in it if I can help it.

Any ideas?


--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux.org 3.5.1-1.fc17.x86_64 GNU/Linux

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to