Forums / General / Function "is_empty" doesn't work...

Function "is_empty" doesn't work...

Author Message

Philip K.

Tuesday 25 October 2005 8:59:11 am

Hello.

In my template I've written the following code:

{section show=$node.object.data_map.field1.content.is_empty|not}
  content of field1 is shown in a grey box
{/section}

But:
The grey box is shown without any content - there is no content in field1.... so why is the box shown??

Thanks for your help...

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

Marko Žmak

Tuesday 25 October 2005 12:45:27 pm

Hm... where did you see that is_empty can be used. To check if an attibute has content use:

{$node.object.data_map.field1.has_content}

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Philip K.

Wednesday 26 October 2005 12:12:05 am

Hm, I found this line of code in another template which wasn't written by me...

But thanks a lot for your answer :)

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

Roy Bøhmer

Monday 31 October 2005 11:49:51 am

Hi!
For the record: I think is_empty can be used on xml-fields.

roy