Forums / Setup & design / showing multi selection values
James Ward
Tuesday 12 February 2008 11:16:42 pm
After reading the documentation I created a multiple selection attribute and tried to output the selected values with the following code:
{for 0 to $node.object.data_map.topics.content|count()|dec as $counter} {$node.object.data_map.topics.class_content.options[$node.object.data_map.topics.value[$counter]].name}, {/for}
It does show all the selected values but it also shows "Array" at the end. I'm assuming my counter is going 1 element past the end of the array but I don't understand why. Has anyone else had this problem or see what I'm doing wrong?
working at www.wardnet.com blogging at www.jamesward.ca
Felix Laate
Wednesday 13 February 2008 1:23:12 am
Hi!
You could try to do something like this:
{def $max = $node.object.data_map.topics.content|count()|dec} Number of elements: {$max} {for 0 to $max as $counter} {$node.object.data_map.topics.class_content.options[$node.object.data_map.topics.value[$counter]].name}, {/for}
If it doesn't do the trick, check out the value of {$max}. Is it correct?
Felix
Publlic Relations Manager Greater Stavanger www.greaterstavanger.com