Forums / General / has_content does not work
Philip K.
Monday 17 July 2006 3:19:46 am
Hello.
I want to display the content of a xml area. But the field mustn't be shown, if it has no content. I use this code:
{if $node.object.data_map.anwendung.has_content} <b>{"Anwendung"|i18n("design/plain/full")}</b><br /> {attribute_view_gui attribute=$node.object.data_map.anwendung} {/if}
There is no content in the xml area but my headline
<b>{"Anwendung"|i18n("design/plain/full")}</b>
is shown anyway... what am I doing wrong?
I's using eZ 3.7.6
Linux is like a wigwam; no windows, now gates, and apache inside!
Marcin Drozd
Monday 17 July 2006 5:24:33 am
Hi Philiptry with
{if $node.object.data_map.anwendung.content.is_empty|not} <b>{"Anwendung"|i18n("design/plain/full")}</b><br /> {attribute_view_gui attribute=$node.object.data_map.anwendung} {/if}
http://ez-publish.pl
Monday 17 July 2006 5:38:28 am
Hi.
thank you for your reply. I tried this some time before and it doesn't work, too.I made some debugging with
{$node.data_map.anwendung|attribute(show)}
to get closer to the problem. Curious is that the xml area is empty. I pressed CTRL + A to mark all the text in the xml area and deleted it, to be sure, that there is no content in it.
But the attribute-list shows the following:
content object[ezxmltext] Object >is_empty boolean false has_content boolean true
But there is no content in it.... any ideas?
Thank you,Philip
Leandro Alves
Monday 17 July 2006 9:38:55 am
Hi!
Try this code..
{if eq($node.object.data_map.anwendung.is_empty)} <b>{"Anwendung"|i18n("design/plain/full")}</b><br /> {attribute_view_gui attribute=$node.object.data_map.anwendung} {/if}
Cheers,
Leandrohttp://www.buildcms.com
Tuesday 18 July 2006 12:11:17 am
Changes nothing. I don't think the code is wrong (all the codes in this thread), I can't understand why "has_content" is true or "is_empty" is false - there is no content in die xml area...
Tuesday 18 July 2006 12:33:17 am
OK, I found out some more. The code is correct. When I disable the Online Editor and save the template, there will be displayed nothing - like it should be.But when I save and the Online Editor is enabled, it will be displayed...
Kirill Subbotin
Tuesday 18 July 2006 1:02:34 am
Just tried it on stable/3.7 and OE 4.1.1 - everything is ok, has_content is false, content.is_empty is true.I tried it with 'article' class and 'body' attribute.
ps. Which OE version are you using?
Tuesday 18 July 2006 1:17:08 am
Yes, you're right. After I've written my last post, I tried it with a newer Version of ezdhtml and now it works.
Thank you all for your help.