• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: need dynamic path in file-exists query
PostPosted: Fri Nov 14, 2008 6:24 pm 
Offline
Forum Members
Forum Members

Joined: Tue Sep 09, 2008 4:51 pm
Posts: 32
I need to find whether a file exists (an image) and then display it if it does exist or ignore if it does not.  That is easy enough.  The problem is that the name of the image I want to discover is not a constant but dynamically determined.

So I need something like this:

Code:
{assign var="articleImg" value="uploads/images/{$entry->title}.jpg"}
{ if file_exists($articleImg) }
   <a href="{$entry->link}"><img src="uploads/images/{$entry->title}.jpg"
   alt="{$entry->title}" /></a>
{/if}


However the value for the articleImg variable is never valid because of the variable used in the path.

This is probably a simple syntax issue, but I am just not getting this to work.

Any ideas?


Top
 Profile  
 
 Post subject: Re: need dynamic path in file-exists query
PostPosted: Fri Nov 14, 2008 6:30 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 6576
Location: Fernie British Columbia, Canada
{capture assign=articleimg}uploads/images/{$entry->title}.jpg{/capture}

_________________
Follow me on twitter
--
if you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
----------------
Don't make me angry..... you won't like me when I'm angry....


Top
 Profile  
 
 Post subject: Re: need dynamic path in file-exists query
PostPosted: Fri Nov 14, 2008 6:56 pm 
Offline
Forum Members
Forum Members

Joined: Tue Sep 09, 2008 4:51 pm
Posts: 32
Many Many thanks!  I knew it was something simple I forgot - doh!  ::)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


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 post attachments in this forum

Search for:
Jump to:  
A2 Hosting