diff --git a/Smarty.class.php b/Smarty.class.php index 74088ee1..c5b1c31b 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -152,8 +152,8 @@ class Smarty var $left_delimiter = '{'; // template tag delimiters. var $right_delimiter = '}'; - var $compiler_class = 'Smarty_Compiler'; // the compiler class used by - // Smarty to compile templates + var $compiler_file = 'Smarty_Compiler.class.php'; // the compiler filename + var $compiler_class = 'Smarty_Compiler'; // the compiler class var $config_class = 'Config_File'; // the config class used by // Smarty to load config vars @@ -1122,7 +1122,12 @@ function _generate_debug_output() { \*======================================================================*/ function _compile_template($tpl_file, $template_source, &$template_compiled) { - require_once SMARTY_DIR.$this->compiler_class . '.class.php'; + if(file_exists(SMARTY_DIR.$this->compiler_file)) { + require_once SMARTY_DIR.$this->compiler_file; + } else { + // use include_path + require_once $this->compiler_file; + } $smarty_compiler = new $this->compiler_class; diff --git a/docs/programmers.sgml b/docs/programmers.sgml index c88602ec..1b3ba3ce 100644 --- a/docs/programmers.sgml +++ b/docs/programmers.sgml @@ -1979,7 +1979,7 @@ $smarty->display("file:F:/path/to/my/templates/menu.tpl"); // from PHP script // put these function somewhere in your application -function db_get_template ($tpl_name, &tpl_source, &$smarty_obj) +function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) { // do database call here to fetch your template, // populating $tpl_source @@ -1995,7 +1995,7 @@ function db_get_template ($tpl_name, &tpl_source, &$smarty_obj) } } -function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj) +function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj) { // do database call here to populate $tpl_timestamp. $sql = new SQL; diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 74088ee1..c5b1c31b 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -152,8 +152,8 @@ class Smarty var $left_delimiter = '{'; // template tag delimiters. var $right_delimiter = '}'; - var $compiler_class = 'Smarty_Compiler'; // the compiler class used by - // Smarty to compile templates + var $compiler_file = 'Smarty_Compiler.class.php'; // the compiler filename + var $compiler_class = 'Smarty_Compiler'; // the compiler class var $config_class = 'Config_File'; // the config class used by // Smarty to load config vars @@ -1122,7 +1122,12 @@ function _generate_debug_output() { \*======================================================================*/ function _compile_template($tpl_file, $template_source, &$template_compiled) { - require_once SMARTY_DIR.$this->compiler_class . '.class.php'; + if(file_exists(SMARTY_DIR.$this->compiler_file)) { + require_once SMARTY_DIR.$this->compiler_file; + } else { + // use include_path + require_once $this->compiler_file; + } $smarty_compiler = new $this->compiler_class;