Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

file_exists

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
amorek
Smarty n00b


Joined: 17 Apr 2004
Posts: 4

PostPosted: Mon Jan 10, 2005 4:38 pm    Post subject: file_exists Reply with quote

Hi.

Is there a plugin that checks if a file exists ?
I have a "foreach" loop and i outpoot the images like image_01.jpg, image_02.jpg, but some of the images are not at the server.
And there i would like to not display the image.
But i can;t check if the image exists in the smarty template.

Any idea/help ?

Amorek


Last edited by amorek on Wed May 05, 2010 10:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Jan 10, 2005 5:54 pm    Post subject: Reply with quote

You could do that work in PHP. That is, only assign the images that should be displayed, or supply a boolean value along with each image that determines if it should display or not (using file_exists() to set each boolean value)

Code:
{section name=foo loop=$images}
   {if $images[foo].display}
      <img src="{$images[foo].name}">
   {/if}
{/section}
Back to top
View user's profile Send private message Visit poster's website
amorek
Smarty n00b


Joined: 17 Apr 2004
Posts: 4

PostPosted: Mon Jan 10, 2005 8:49 pm    Post subject: Reply with quote

Yes i thought so, and i think i will do that.

Thanks

amorek
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP