Jump to content

file_exists on category images


Recommended Posts

In my theme, I have category images as standard, but I also have a completely different image for each (well most) of the categories that is called as a header graphic in category.tpl based on the category ID, like this:

id_category}.gif" alt="{$category->name}" style="margin-top:10px;"/>



What I would like to do is only show these if the file exists, as it doesn't in every case and I don't want to display 404.gif. Can anyone tell me what the syntax would be? I struggle a bit with the smarty stuff!

I got as far as

{if file_exists($base_dir.img/headers/$category->id_category.gif)}



Many thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...