Forums / Setup & design / How to set arrays dynamically?

How to set arrays dynamically?

Author Message

Ulrich L.

Tuesday 22 March 2005 12:38:28 pm

Hi,
I wonder how I manage to set arrays e.g. like this (not working of course...):

{let arr=array()}
{section var=myloop loop=$loopsomething}
     {$myloop.name}
     {set arr.index=$myloop.name}
{/section}
{/let}

How is this possible?

Gabriel Ambuehl

Tuesday 22 March 2005 12:48:48 pm

Do you absolutely need to set the index? Or just add the element, as that can be done with append().

Visit http://triligon.org

Ulrich L.

Wednesday 23 March 2005 1:54:38 pm

Thanks, this helped indeed.
It looks now like this:

{let arr=array()}
{section var=myloop loop=$loopsomething}
     {set arr=$arr|append($myloop.name)}
{/section}
{/let}