Thursday 30 March 2006 8:33:25 am
Hi, I would like to use variable variables in a template, and was sure to have done so before, but i can neither find the template nor can i get this running. I have a class that consists of several elements of the same datatype (object relation), following the naming convention related_[number], where number is an int from 1 to 4. The following code doesnt work and is only an example. What i want to archive is that [$number] gets substituted by the actual value of $number:
{def $out=array() $myobj=$node.object.data_map}
{for 0 to 4 as $number}
{set $out = $out|append( hash( 'link', $myobj.related_[$number].content.main_node.url_alias,
'maincat', $myobj.related_[$number].content.main_node.path.1.name,
'teaser', $myobj.related_[$number].main_node.data_map.teaser.content ))}
{/for}
Any ideas would be highly appreciated! Thanks, Patrick
Best regards,
Patrick
|