Attribute!=null, or how to check for actual content in an attribute.

Attribute!=null, or how to check for actual content in an attribute.

Wednesday 07 January 2004 9:22:56 am - 2 replies

Modified on Wednesday 07 January 2004 9:33:56 am by Tore Skobba

Author Message

Shurbann Martes

Wednesday 07 January 2004 10:49:10 am

Why do things difficult if it can be accomplished the easy way?

{section show=$node.object.data_map.ingress.content}

is a very good, clever and simple way to check for the content

{section show=.....}

takes any value except false. If the value is false it will skip the section. So the implementation is not "rude", but I would say clever. ;)

A programmer always use the clever and easiest way to accomplish things. And if you want the code to be readable by someone else (why you're doing the above) use comment.

-Shurbann

Tore Skobba

Wednesday 07 January 2004 4:37:43 pm

Hi

I have done it as described now, but I do not think it is a very clever way as you are directly checking on an variabel which you do not know is going to be there in future releases of EZ. What I am missing is an function for checking for actual content. Ala

{section show=is_set($node.object.data_map.ingress)}

This as a function could be rewritten if "content" where to disapper in future releases, or have different values. I belive that checking for actual content should be a mandatory function! The fact that content return "false", and not null when there is no content is not very initutive I think.

But thanks for tip:).

Cheers
Tore

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.