rendered paste body{template_exists tpl="foobar"}{include "foobar"}{/template_exists}
block.template_exists.php
<?php
function smarty_block_template_exists($params,$content,&$smarty,&$repeat){
$template = $params["tpl"];
if ( $smarty->template_exists($template) ){ return $content; }
return "";
}
?>
=================================================================================
{template_exists tpl="foobar" var="doesit"}{if $doesit}{include file="foobar"}{/if}
function.template_exists.php
<?php
function smarty_function_template_exists($params,&$smarty){
$template = $params["tpl"];
$assignTo = $params["var"];
$smarty->assign($assignTo, $smarty->template_exists($template) ? 1 : 0);
}
?>