Forums / Setup & design / Template: How to get the value of a checkbox and enum

Template: How to get the value of a checkbox and enum

Author Message

Helle Andersen

Monday 29 December 2003 5:06:55 am

I havea checkbox attribute named "pressemeddelelser" - if it is checked I want the template to write "Pressemeddelelse", if not nothing.
I have tried something like:
{section show=eq( $node.object.data_map.pressemeddelelse.content > "1")}
{/section}

But this doesn't work - any suggestions ?

And how do I write the values of enum?

Helle Andersen

Paal Are Solberg

Tuesday 30 December 2003 1:38:46 am

Check value like this:

{section show=$content_version.data_map.pressemeddelelser.content|eq(1)}

Write value like in this example?:
{let enumsted=fetch('content','class_attribute',hash(attribute_id,188,version_id,0))}

{section name=Steder loop=$enumsted.content.enum_list sequence=array(bglight,bgdark)}

{$Steder:item.enumelement}
{/section}
{/let}

Helle Andersen

Tuesday 30 December 2003 4:46:58 am

Thanks, but the value of a checkbox still doesn't work . I still get the error message:
Error: eZTemplate Cannot retrieve attribute of a boolean

Paal Are Solberg

Tuesday 30 December 2003 7:12:13 am

1) check spelling? there's an "r" at the end of pressemeddelelser..?

2)try a debug sentence above your "section", i.e:

value is: {$node.object.data_map.pressemeddelelser.content}
{section show=$node.object.data_map.startside.content|eq(1)}
{/section}

--> do you get value "1" printed?

Do you need the ".object"?, i.e try this:

value is: {$node.data_map.pressemeddelelser.content}
{section show=$node.data_map.startside.content|eq(1)}
{/section}

..sorry, I'm guessing here...I'f I'm to help you,I need to see more of your code?

Ben Pirt

Tuesday 06 January 2004 4:39:44 am

I'm not sure if this is the correct way to do this, but this works for me;

{section show=$node.object.data_map.comments.content.enumobject_list.0.enumvalue}

where comments is an enum attribute with a value of either 1 or 0. Spent quite a while going through attribute(show) to find it.

Hope this helps,
Ben Pirt