Forums / General / has_content does not work

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!

eZ debug

Timing: Jan 18 2025 05:16:29
Script start
Timing: Jan 18 2025 05:16:29
Module start 'content'
Timing: Jan 18 2025 05:16:30
Module end 'content'
Timing: Jan 18 2025 05:16:30
Script end

Main resources:

Total runtime1.0296 sec
Peak memory usage4,096.0000 KB
Database Queries213

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.7031180.8438
Module start 'content' 0.00650.8723 768.5469670.4531
Module end 'content' 0.87880.1505 1,439.0000340.4453
Script end 1.0293  1,779.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4089210.0002
Check MTime0.00150.1494210.0001
Mysql Total
Database connection0.00120.119110.0012
Mysqli_queries0.934190.72982130.0044
Looping result0.00260.25692110.0000
Template Total0.997096.820.4985
Template load0.00210.206520.0011
Template processing0.994896.626120.4974
Template load and register function0.00010.013510.0001
states
state_id_array0.00220.209610.0022
state_identifier_array0.00220.215020.0011
Override
Cache load0.00190.1848500.0000
Sytem overhead
Fetch class attribute can translate value0.00180.172450.0004
Fetch class attribute name0.00190.186690.0002
XML
Image XML parsing0.00150.148050.0003
class_abstraction
Instantiating content class attribute0.00000.0027130.0000
General
dbfile0.00600.5869270.0002
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 43
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs