template_exists()checks whether the specified template existsDescriptionbooltemplate_existsstringtemplate
It can accept either a path to the template on the filesystem or a
resource string specifying the template.
template_exists()
This example uses $_GET['page'] to include a content template. If
the template doesnt exist then an error page is displayed instead.
The page_container.tpl{$title}
{include file='page_top.tpl'}
{* include middle content page *}
{include file=$page_mid}
{include file='page_footer.tpl'}
]]>
and the php script
template_exists($template_name) ){
$filename= 'page_not_found.inc.tpl';
}
$smarty->assign('page_mid', $template_name);
$smarty->display('page_container.tpl');
?>
]]>
See also
display(),
fetch(),
{include}
and
{insert}