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

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 18:39:28
Script start
Timing: Jan 18 2025 18:39:28
Module start 'layout'
Timing: Jan 18 2025 18:39:28
Module start 'content'
Timing: Jan 18 2025 18:39:29
Module end 'content'
Timing: Jan 18 2025 18:39:29
Script end

Main resources:

Total runtime1.1334 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.1563152.6563
Module start 'layout' 0.00540.0028 740.812539.5078
Module start 'content' 0.00811.1237 780.3203530.6484
Module end 'content' 1.13180.0015 1,310.968812.1094
Script end 1.1333  1,323.0781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2942160.0002
Check MTime0.00140.1276160.0001
Mysql Total
Database connection0.00060.050610.0006
Mysqli_queries1.077495.0573650.0166
Looping result0.00100.0841630.0000
Template Total1.096296.720.5481
Template load0.00220.197620.0011
Template processing1.093996.517220.5470
Template load and register function0.00020.016110.0002
states
state_id_array0.00090.076710.0009
state_identifier_array0.00180.155620.0009
Override
Cache load0.00180.1611400.0000
Sytem overhead
Fetch class attribute can translate value0.00090.077030.0003
Fetch class attribute name0.00120.104450.0002
XML
Image XML parsing0.00040.032830.0001
class_abstraction
Instantiating content class attribute0.00000.001050.0000
General
dbfile0.00070.0633100.0001
String conversion0.00000.000840.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs