diff --git a/change_log.txt b/change_log.txt index b47ea29b..5219ea2b 100644 --- a/change_log.txt +++ b/change_log.txt @@ -10,6 +10,7 @@ - optimize rendering - move caching to Smarty::_cache - remove properties with redundant content + - optimize Smarty::templateExists() 06.08.2015 - avoid possible circular object references caused by parser/lexer objects diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 4cf43f45..346bc993 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -737,14 +737,9 @@ class Smarty extends Smarty_Internal_TemplateBase */ public function templateExists($resource_name) { - // create template object - $save = $this->_cache['template_objects']; - $tpl = new $this->template_class($resource_name, $this); - // check if it does exists - $result = $tpl->source->exists; - $this->_cache['template_objects'] = $save; - - return $result; + // create source object + $source = Smarty_Template_Source::load(null, $this, $resource_name); + return $source->exists; } /**