showing multi selection values

Author Message

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 03:27:31
Script start
Timing: Jan 19 2025 03:27:31
Module start 'layout'
Timing: Jan 19 2025 03:27:31
Module start 'content'
Timing: Jan 19 2025 03:27:32
Module end 'content'
Timing: Jan 19 2025 03:27:32
Script end

Main resources:

Total runtime1.0470 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.1563152.6250
Module start 'layout' 0.00660.0025 741.781339.4609
Module start 'content' 0.00911.0363 781.2422527.4531
Module end 'content' 1.04530.0016 1,308.69538.1641
Script end 1.0469  1,316.8594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2975160.0002
Check MTime0.00130.1265160.0001
Mysql Total
Database connection0.00100.091410.0010
Mysqli_queries0.999195.4289540.0185
Looping result0.00050.0437520.0000
Template Total1.015797.020.5079
Template load0.00190.177020.0009
Template processing1.013896.837220.5069
Template load and register function0.00010.009510.0001
states
state_id_array0.00070.069310.0007
state_identifier_array0.00100.091420.0005
Override
Cache load0.00160.1487140.0001
Sytem overhead
Fetch class attribute can translate value0.00060.061620.0003
Fetch class attribute name0.00090.087340.0002
XML
Image XML parsing0.00120.118120.0006
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00310.2970220.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs