Forums / Setup & design / Use of is_empty

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