how can I check if a file object (datatype file) is empty?

Author Message

Jens Tiedemann

Tuesday 04 March 2008 4:50:54 am

{if $node.data_map.related_file.filename.is_empty|not}

always seem to return True....

Stéphane Bullier

Tuesday 04 March 2008 5:18:22 am

Hi,

You can use :
{if $node.data_map.related_file.has_content}
true
{else}
false
{/if}

Stéphane

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

Main resources:

Total runtime1.4420 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.3984152.6563
Module start 'layout' 0.00560.0041 742.054739.5078
Module start 'content' 0.00961.4308 781.5625518.8359
Module end 'content' 1.44040.0016 1,300.39848.2500
Script end 1.4420  1,308.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2312160.0002
Check MTime0.00130.0913160.0001
Mysql Total
Database connection0.00080.052010.0008
Mysqli_queries1.395996.8031540.0259
Looping result0.00060.0414520.0000
Template Total1.409097.720.7045
Template load0.00190.131720.0009
Template processing1.407197.578120.7036
Template load and register function0.00030.017610.0003
states
state_id_array0.00130.087010.0013
state_identifier_array0.00100.071920.0005
Override
Cache load0.00160.1100140.0001
Sytem overhead
Fetch class attribute can translate value0.00070.049820.0004
Fetch class attribute name0.00150.102130.0005
XML
Image XML parsing0.00320.224820.0016
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00420.2902160.0003
String conversion0.00000.000640.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs