[Templates] Compound arrays (arrays of arrays) and FOREACH

Jim Garrison jhg@acm.org
Sun, 12 Oct 2003 20:52:35 -0500


When applying FOREACH to an array of arrays, nothing gets
executed.  (Template version 2.10) What am I missing?

-----BEGIN TEMPLATE-----
<table>
[% arr = [ [ 'a', 'b', 'c'], ['d', 'e', 'f' ] ] %]

[% arr %]
[% arr.0 %]
[% arr.0.0 %]
[% arr.1.1 %]
[% arr.size %]

[% FOREACH a IN arr %]
     <tr>
     [% FOREACH b IN a %]
         <td>[% b %]</td>
     [% END %]
     </tr>
[% END %]

</table>
------END TEMPLATE------

-----BEGIN OUTPUT-----
<table>


ARRAY(0x8114268)
ARRAY(0x839da74)
a
e
2



</table>
------END OUTPUT------

The five output statements before the first FOREACH
confirm that the data structure is correctly built.
So why doesn't the outer FOREACH execute anything?

Jim Garrison
jhg@acm.org