Check the value of a field

Author Message

Philip K.

Wednesday 07 December 2005 8:16:52 am

Hi.

I have a little problem:
I want to check the value of a field in my class.

{if $node.object.data_map.<fieldname>.content = '<value>'}
  do this
{else}
  do this
{/if}

...but it doensn't work as I want it to work... any ideas??

There might be an easy way to do it, but I'm new in eZ and have some problems with it...

Thanks.

Linux is like a wigwam; no windows, now gates, and apache inside!

Ɓukasz Serwatka

Tuesday 13 December 2005 1:56:17 am

Hi Philip,

You were very close ;)

eZ publish tpl syntax uses operators for comparing values.

Look on this documentation page:
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/logical_operations

Example for text string attribute:

{if eq( $node.object.data_map.<fieldname>.content.data_text, 'value' )} 
 do this 
{else} 
 do this 
{/if} 

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Philip K.

Tuesday 13 December 2005 7:45:57 am

thank you - works :)

Linux is like a wigwam; no windows, now gates, and apache inside!

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 20 2025 00:23:33
Script start
Timing: Jan 20 2025 00:23:33
Module start 'layout'
Timing: Jan 20 2025 00:23:33
Module start 'content'
Timing: Jan 20 2025 00:23:33
Module end 'content'
Timing: Jan 20 2025 00:23:33
Script end

Main resources:

Total runtime0.0319 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 589.1484152.6250
Module start 'layout' 0.00690.0052 741.773439.4453
Module start 'content' 0.01210.0178 781.218889.4141
Module end 'content' 0.02980.0021 870.632834.3047
Script end 0.0319  904.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00257.8890140.0002
Check MTime0.00113.5384140.0001
Mysql Total
Database connection0.00082.573910.0008
Mysqli_queries0.005416.960530.0018
Looping result0.00000.075410.0000
Template Total0.00165.010.0016
Template load0.00092.686710.0009
Template processing0.00072.298510.0007
Override
Cache load0.00061.856610.0006
General
dbfile0.004714.702480.0006
String conversion0.00000.035140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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