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

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 19 2025 06:07:18
Script start
Timing: Jan 19 2025 06:07:18
Module start 'layout'
Timing: Jan 19 2025 06:07:18
Module start 'content'
Timing: Jan 19 2025 06:07:19
Module end 'content'
Timing: Jan 19 2025 06:07:19
Script end

Main resources:

Total runtime0.5948 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.1484152.6250
Module start 'layout' 0.00660.0040 741.773439.4453
Module start 'content' 0.01050.5831 781.2188585.6875
Module end 'content' 0.59360.0012 1,366.906312.4688
Script end 0.5947  1,379.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.6000160.0002
Check MTime0.00130.2240160.0001
Mysql Total
Database connection0.00100.167810.0010
Mysqli_queries0.539790.7485620.0087
Looping result0.00060.1058600.0000
Template Total0.561394.420.2806
Template load0.00220.375620.0011
Template processing0.559093.988120.2795
Template load and register function0.00010.016310.0001
states
state_id_array0.00100.163110.0010
state_identifier_array0.00130.214020.0006
Override
Cache load0.00190.3140220.0001
Sytem overhead
Fetch class attribute can translate value0.00050.091830.0002
Fetch class attribute name0.00110.188360.0002
XML
Image XML parsing0.00130.217330.0004
class_abstraction
Instantiating content class attribute0.00000.001770.0000
General
dbfile0.00090.1570240.0000
String conversion0.00000.002240.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs