- improvment better error message for undefined templates at {include}

This commit is contained in:
uwe.tews@googlemail.com
2011-09-24 18:20:13 +00:00
parent 5c0d7ad8b4
commit a98d83bbf3
4 changed files with 36 additions and 20 deletions
@@ -116,7 +116,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
}
// checks if template exists
if (!$_template->source->exists) {
throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'");
if ($_template->parent instanceof Smarty_Internal_Template) {
$parent_resource = " in '{$_template->parent->template_resource}'";
} else {
$parent_resource = '';
}
throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
}
// read from cache or render
if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {