Okay - there is not a standard smarty or xcart way of doing this but....
first:
create a new modifier file: modifier.file_exist.php and save it into your smarty plugins folder.
Code:
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: modifier
* Name: file_exists
* Purpose: checks if a file exist
* -------------------------------------------------------------
*/
function smarty_modifier_file_exists($params, &$smarty)
{
extract($params);
if (empty($file)) {
$smarty->trigger_error("assign: missing 'file' parameter");
return;
}
return file_exists($file);
}
?>
Then in the template where you wish for the file check to be used:
{assign var="file" value="the_image_check_for.gif"}
{if $file|file_exists}
[img]{$file}[/img]
{else}
Show another image
{/if}
That'll do it
