Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
currently i have this data structure
$nodes = [ { 'name' => 'Testing Message', 'children' => [ { 'name' => 'Hello world', 'children' => [ { 'name' => 'inside', 'children' => [], 'id' => '3' } ], 'id' => '2' } ], 'id' => '1' } ];
and i am using this block in Template Toolkit to get the output :
this will generate the output like this:[% VIEW nested %] [% BLOCK list %] <ul> [% FOREACH i IN item %] <li>[% i.name %]</li> [% IF i.children.size %] [% view.print(i.children.list) %] [% END %] [% END %] </ul> [% END %] [% END %] [% nested.print(nodes) %]
<ul> <li>Test</li> <ul> <li>Hello</li> <ul><li>inside</li> </ul> </ul> </ul>
Expected output:
<ul> <li>Test <ul> <li>Hello <ul><li>inside</li> </ul> </li> </ul> </li> </ul>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Valid Nested Output
by Corion (Patriarch) on May 17, 2010 at 14:18 UTC | |
by Anonymous Monk on May 17, 2010 at 15:15 UTC |