Wednesday 14 May 2008 6:14:06 am
Hello, how do I create a multi-dimensional array in the eZ template language without static assignments? I tried several approaches but all of them failed. a naive approach that does not work but illustrates the task:
{for 0 to 6 as $x}
{set $tmparr = array()}
{for 0 to 6 as $y}
{set $data[$x][$y] = $x|mul($y)}
{/for} {/for} So I tried to use a temporary one-dimensional array and assign it to a column/row of the 2-dim array, as in:
{for 0 to 6 as $x}
{set $tmparr = array()}
{for 0 to 6 as $y}
{set $tmparr = $tmparr|append($x|mul($y))}
{/for}
{set $data[$x]=$tmparr} {/for} My research showed that it is not possble make an assignment with something else than a "variable" on the left side of the assignment operator, according to http://issues.ez.no/6981 for instance. So, how can I achieve what I want in the eZ template language?
Thanks Oliver
|