Hi,

I hope I not being either lazy or dim but I can't seem to get this.

I am creating a table (I can't use the table plugin, the data does
suit) and need to access array elements after they have gone out of
scope. In the table below, I write the table headers from the array x,
finish with array x and start writing the rows. As I am writing out
the td's in each row I need to refer their column. I thought that
loop.index might help, I had hoped I could do x.loop.index to grab the
nth element from the header array. Alas not. I can't seem to find a
way to interpolate the loop.index and array, EG x.loop.index will not
work.  Does anyone have any advice, I struggling today.
Thanks,
Dermot.


           <table border="1" >
               <tr>
                   <th></th>
                   [% FOREACH th IN x  %]
                       <th>[% th.value | html %]</th>
                   [% END %]
                   </tr>
                   [% FOREACH cell IN y %]
                       <tr><td>[% cell.value | html %]</td>[% FOREACH
cell IN y %]
                           <td>[% idx = loop.index %]
                           <input type="text" name="foo" value="[%
x.idx  %]" />
                           </td>[% END %]
                       </tr>
                   [% END %]
          </table>

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to