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.