File_exist: A question

Author Message

Zinistry Vacana

Monday 05 May 2003 6:42:31 am

Is it possible to check for file_exist in a template?
I have pictures of users in the system (search-site which lists user-information) and want to show pictures of them, but don't want the img tag to be showed in the browser if the image does not exist. Mozilla don't show it anyway if the Image don't exist, but IE does, so I have to do a check here.

Something like this, but the show=eq (file check if not empty)don't work:
{section show=eq("http://www.*.*/pictures/$SearchResult:item.email[.jpg]",' ' )|not() }
<td><img src="http://www.*.*/pictures/$SearchResult:item.email.jpg"</td>
{/section]

Don't know how to solve this problem :/
Shortly: the users are in the db, $SearchResult:item.email contains the emails looped and listed out for every user, and this data ($) I use to retrieve the Image which have name like the email.

Marco Zinn

Tuesday 06 May 2003 1:16:13 pm

No clue, but a counter-question ;)

Why don't you expand your class (user class, if you use this) to have a new attribute "image", upload them there and check for the existance of that attribute ?
I suppose, that would "better" and easier to do.

Marco
http://www.hyperroad-design.com

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 16:28:17
Script start
Timing: Jan 30 2025 16:28:17
Module start 'layout'
Timing: Jan 30 2025 16:28:17
Module start 'content'
Timing: Jan 30 2025 16:28:18
Module end 'content'
Timing: Jan 30 2025 16:28:18
Script end

Main resources:

Total runtime1.2673 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 588.1250151.2109
Module start 'layout' 0.00420.0034 739.3359220.6875
Module start 'content' 0.00771.2587 960.02344,432.4609
Module end 'content' 1.26630.0009 5,392.48447.8594
Script end 1.2672  5,400.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2637160.0002
Check MTime0.00120.0984160.0001
Mysql Total
Database connection0.00060.045010.0006
Mysqli_queries1.184793.4816540.0219
Looping result0.00050.0410520.0000
Template Total1.218396.120.6092
Template load0.00180.144620.0009
Template processing1.216595.990520.6082
Template load and register function0.00160.127510.0016
states
state_id_array0.00210.163410.0021
state_identifier_array0.00140.108820.0007
Override
Cache load0.00150.1147160.0001
Sytem overhead
Fetch class attribute can translate value0.00170.133220.0008
Fetch class attribute name0.00240.190230.0008
XML
Image XML parsing0.00200.154420.0010
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00310.2449160.0002
String conversion0.00000.000540.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
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs