has_content does not work

Author Message

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 Philip
try 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

Philip K.

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

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

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,

Leandro
http://www.buildcms.com

Philip K.

Tuesday 18 July 2006 12:11:17 am

Hi.

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...

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

Philip K.

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...

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

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?

Philip K.

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.

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

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 30 2025 22:27:47
Script start
Timing: Jan 30 2025 22:27:47
Module start 'layout'
Timing: Jan 30 2025 22:27:47
Module start 'content'
Timing: Jan 30 2025 22:27:47
Module end 'content'
Timing: Jan 30 2025 22:27:47
Script end

Main resources:

Total runtime0.0456 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0040 588.1250151.2109
Module start 'layout' 0.00410.0031 739.3359220.6875
Module start 'content' 0.00710.0364 960.02341,005.8828
Module end 'content' 0.04350.0020 1,965.906337.9922
Script end 0.0455  2,003.8984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00275.8784140.0002
Check MTime0.00102.2800140.0001
Mysql Total
Database connection0.00051.141610.0005
Mysqli_queries0.00183.971130.0006
Looping result0.00000.022010.0000
Template Total0.00143.010.0014
Template load0.00102.254310.0010
Template processing0.00030.742210.0003
Override
Cache load0.00071.536710.0007
General
dbfile0.017638.738180.0022
String conversion0.00000.013640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs