I think your structure is fine. You just have to think more “perlishly” for your iteration. This should get you on the path to what you want–
use strictures; use Template; my $stuff = [ { 'filenameLarge' => [ 'fIyvYwJWmstR.jpg', 'koeSHYEaekfv.jpg', 'CtDKXyiRXhWz.jpg' ], 'title' => 'February event (Feb 2013)', 'bookid' => 8 } ]; my $tt = Template->new; $tt->process(\*DATA, { fotos => $stuff }) || die $tt->error(), "\n"; __DATA__ [%-FOR e IN fotos %] [%-e.title %] [%-FOR i IN e.filenameLarge %] <img src="/photo/[% e.bookid %]/tn/[% i %]" /> [%-END %] [%-END %]
Yields–
February event (Feb 2013) <img src="/photo/8/tn/fIyvYwJWmstR.jpg" /> <img src="/photo/8/tn/koeSHYEaekfv.jpg" /> <img src="/photo/8/tn/CtDKXyiRXhWz.jpg" />
In reply to Re: Template Toolkit - problem getting data out array - AoHoA
by Your Mother
in thread Template Toolkit - problem getting data out array - AoHoA
by GertMT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |