Sunday 01 May 2005 3:13:18 pm
Lets assume that we have given an array of contentObjects ($contentobject_array). This array should be iterated to extract the ID of each element used to fill a new array ($folder_node_id_array). Outside of the iteration ({section}-template-function) the new generated array must be available for further processing.
The template code: ------------------
{let folder_node_id_array=array()}
{section var=folder loop=$contentobject_array}
{set folder_node_id_array=$folder_node_id_array|append($folder.item.main_node.node_id) }
A:{$folder_node_id_array|attribute(show)}
{/section}
<br>B:{$folder_node_id_array|attribute(show)}
{/let}
At A: the correct new array is displayed as expected. But at B: there is not even something displayed. The variable $folder_node_id_array seems to be vanished, although its still in the scope of the let-template-function.
According to the description of the let-template-function I quote the following: "Assigns one or more variables <b>within its tags</b>. The assigned variables are freed (released) at the end tag."
-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org
|