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

eZ debug

Timing: Jan 31 2025 00:18:57
Script start
Timing: Jan 31 2025 00:18:57
Module start 'content'
Timing: Jan 31 2025 00:18:57
Module end 'content'
Timing: Jan 31 2025 00:18:57
Script end

Main resources:

Total runtime0.3156 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0111 588.1719370.2734
Module start 'content' 0.01110.0141 958.44531,005.4844
Module end 'content' 0.02520.2903 1,963.92973,894.0391
Script end 0.3156  5,857.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00411.3149200.0002
Check MTime0.00130.4032200.0001
Mysql Total
Database connection0.00090.291210.0009
Mysqli_queries0.216768.66721410.0015
Looping result0.00130.41871390.0000
Template Total0.289991.910.2899
Template load0.00080.259910.0008
Template processing0.289191.605410.2891
Override
Cache load0.00060.194210.0006
Sytem overhead
Fetch class attribute can translate value0.00170.533210.0017
XML
Image XML parsing0.00020.078910.0002
General
dbfile0.01705.4015200.0009
String conversion0.00000.002630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs