Use of is_empty

Author Message

Pascal France

Tuesday 16 May 2006 5:52:02 am

Hi,

I have two class datatype: attribut_1 and attribut_2
I want to display these attribut sections only if attributs are not empty.
I did this:

 39    {section show=$node.data_map.attribut_1.content.is_empty|not}
 40     The first attribute is: {attribute_view_gui attribute=$node.data_map.attribut_1}<br />
 41    {/section}
 42    {section show=$node.data_map.interphone.attribut_2.is_empty|not}
 43     The second attribut is: {attribute_view_gui attribute=$node.data_map.attribut_2}<br />
 44    {/section}

But I get at least:

The first attribute is:
The second attribut is:

both attributes are empty or not.

Cordialy,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Kristof Coomans

Tuesday 16 May 2006 6:31:06 am

Hi Pascal

What datatype do these attributes have?

Try to use

$node.data_map.attribut_1.has_content

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Pascal France

Tuesday 16 May 2006 7:02:10 am

Thanks a lot Kristof,

it works fine.

These datatypes are textline.
What use of is_empty shoud I do ?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Kristof Coomans

Tuesday 16 May 2006 11:25:46 am

You can use is_empty on the content of an attribute with the author or xml block datatype, but using has_content directly on the attribute will serve as a shortcut. So to avoid any confusion, always try to use has_content.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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 19 2025 04:39:47
Script start
Timing: Jan 19 2025 04:39:47
Module start 'layout'
Timing: Jan 19 2025 04:39:47
Module start 'content'
Timing: Jan 19 2025 04:39:48
Module end 'content'
Timing: Jan 19 2025 04:39:48
Script end

Main resources:

Total runtime1.0101 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.0313152.6094
Module start 'layout' 0.00660.0035 741.640639.4297
Module start 'content' 0.01010.9987 781.0703549.2422
Module end 'content' 1.00880.0013 1,330.312512.1953
Script end 1.0101  1,342.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3587160.0002
Check MTime0.00160.1557160.0001
Mysql Total
Database connection0.00110.108610.0011
Mysqli_queries0.950894.1210600.0158
Looping result0.00070.0708580.0000
Template Total0.969295.920.4846
Template load0.00230.226420.0011
Template processing0.966995.716620.4834
Template load and register function0.00020.021710.0002
states
state_id_array0.00370.366810.0037
state_identifier_array0.00200.196020.0010
Override
Cache load0.00190.1872280.0001
Sytem overhead
Fetch class attribute can translate value0.00070.067020.0003
Fetch class attribute name0.00170.165650.0003
XML
Image XML parsing0.00060.055720.0003
class_abstraction
Instantiating content class attribute0.00000.001860.0000
General
dbfile0.00210.2102160.0001
String conversion0.00000.001040.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs