How to get the selection attribute name

Author Message

Romeo Antony

Wednesday 29 September 2010 2:43:37 am

I have extended atricle class by a selection attribute with (single selection)

How do I fetch the name of the selection attribute in template

{$node.object.datamap.selection_attribute_identifier. **** what will be here ************ }

When I fetch the reurn array I can get only the array values 0,1,2,3,

How can I get the Value name instead of 0,1,2,3,?

Please help

Matthieu Sévère

Wednesday 29 September 2010 2:54:54 am

Hi Romeo,

You'll need to fetch the content class attribute and then fetch the name matching your IDs 0,1,2,3 ..

See there to get the class matching your current object : http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Objects/ezcontentobjecttreenode

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 3:14:06 am

Thanks for the reply.

that means do I need to code some conditions like if the value of array is 0 then print a name
if valuse is 2 then print next name

i have got an alternative solution by

{attribute_view_gui attribute=$valid_nodes[0].object.data_map.selection attribute}

Matthieu Sévère

Wednesday 29 September 2010 3:25:11 am

Your alternative solution is the good one. It calls the template content/datatype/view/ezselection.tpl you should have a look at this template to understand the mechanism

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 4:16:49 am

ya. I will try that .

Sorry to bother you again. A small doubt .

I need to display nodes in dynamic block. Only the nodes tthas has a specific selection attribute value will be only fetched. For that any idea what attribute filter should I set in fetch class or do

Can u please give me suggetion.

Matthieu Sévère

Wednesday 29 September 2010 4:27:07 am

"

ya. I will try that .

Sorry to bother you again. A small doubt .

I need to display nodes in dynamic block. Only the nodes tthas has a specific selection attribute value will be only fetched. For that any idea what attribute filter should I set in fetch class or do

Can u please give me suggetion.

"

You need to give the id, like array('your_class/your_attribute','=',1)

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 4:34:31 am

Alright. I got it.

Thanks a lot Matthieu.

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 18 2025 10:38:48
Script start
Timing: Jan 18 2025 10:38:48
Module start 'layout'
Timing: Jan 18 2025 10:38:48
Module start 'content'
Timing: Jan 18 2025 10:38:49
Module end 'content'
Timing: Jan 18 2025 10:38:49
Script end

Main resources:

Total runtime0.6837 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 589.1641152.6406
Module start 'layout' 0.00460.0035 741.804739.4844
Module start 'content' 0.00810.6742 781.2891592.2891
Module end 'content' 0.68230.0014 1,373.578116.1406
Script end 0.6837  1,389.7188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4601160.0002
Check MTime0.00130.1837160.0001
Mysql Total
Database connection0.00060.088010.0006
Mysqli_queries0.612189.5171700.0087
Looping result0.00070.0969680.0000
Template Total0.652595.420.3262
Template load0.00220.319320.0011
Template processing0.650395.108220.3251
Template load and register function0.00010.011710.0001
states
state_id_array0.00120.178010.0012
state_identifier_array0.00090.124620.0004
Override
Cache load0.00190.2739440.0000
Sytem overhead
Fetch class attribute can translate value0.00170.254920.0009
Fetch class attribute name0.00160.237590.0002
XML
Image XML parsing0.00090.126420.0004
class_abstraction
Instantiating content class attribute0.00000.0044140.0000
General
dbfile0.00090.1283220.0000
String conversion0.00000.004340.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
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs