On 24 Aug 2005 09:58:31 -0700, Randal L. Schwartz <[email protected]> wrote:
> >>>>> "Sergey" == Sergey  <[EMAIL PROTECTED]> writes:
> 
> 
> Sergey> $VAR1 = bless( [
> Sergey> {
> Sergey> 'content' => 'c1',
> Sergey> 'name' => 'abc',
> Sergey> 'id' => '21',
> Sergey> 'image' => 'tree/21/4.gif'
> Sergey> },
> Sergey> {
> Sergey> 'content' => 'c2',
> Sergey> 'name' => 'xyz',
> Sergey> 'id' => '22',
> Sergey> 'image' => 'tree/22/wp1.gif'
> Sergey> }
> Sergey> ], 'S5::Tree::ListObject' );
> Sergey> ==============================
> 
> Because "persons" is blessed, persons.0 is treated as a method
> call, not an index lookup.

You can fool TT into treating it like a list by using slice(0) to copy
just the array values to a temp var.

[% SET personslist = persons.slice(0) %]
[% a=0; WHILE a < personslist.size() %]
[% a; " : "; personslist.$a.name %]
<br>
[% a=a+1 %]
[% END %]


Not sure if this is really good practise though.  You have an object, so use it!

Cheers,

Cees

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

Reply via email to