X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Ftemplate%2FSmarty_Template.class.php;h=e666eb002eb3c3735d2e1ec5cfb54c060114715d;hp=1e4dde88a7b50e97e9be6d15c5ac2fd57650f57a;hb=335aac838df96dc73774aa319074deb2ace3a000;hpb=de4d58cb7fdcda16e5129a26db1a6a3d46d6594f;ds=sidebyside diff --git a/class/template/Smarty_Template.class.php b/class/template/Smarty_Template.class.php index 1e4dde88..e666eb00 100644 --- a/class/template/Smarty_Template.class.php +++ b/class/template/Smarty_Template.class.php @@ -54,37 +54,26 @@ class Smarty_Template extends Template parent::Template($template_id); - // pull in the tempalte config file and load smarty settings + // load smarty settings // - $template_config_file = SM_PATH . $this->get_template_file_directory() - . 'config.php'; - if (!file_exists($template_config_file)) { - - trigger_error('No template configuration file was found where expected: ("' - . $template_config_file . '")', E_USER_ERROR); - - } else { - - require($template_config_file); - - - // instantiate and set up Smarty object - // -//LEFT OFF HERE - check for this as empty or not - require($smarty_path); - $this->smarty_template = new Smarty(); -//LEFT OFF HERE - check for these as empty or not.... I think we at least need compile dir? - $this->smarty_template->compile_dir = $smarty_compile_dir; - $this->smarty_template->cache_dir = $smarty_cache_dir; - $this->smarty_template->config_dir = $smarty_config_dir; - - // note that we do not use Smarty's template_dir - // because SquirrelMail has its own method of - // determining template file paths - // - //$this->smarty_template->template_dir = - - } + // instantiate and set up Smarty object + // + $smarty_path + = Template::get_template_config($this->template_set_id, 'smarty_path'); + require($smarty_path); + $this->smarty_template = new Smarty(); + $this->smarty_template->compile_dir + = Template::get_template_config($this->template_set_id, 'smarty_compile_dir'); + $this->smarty_template->cache_dir + = Template::get_template_config($this->template_set_id, 'smarty_cache_dir'); + $this->smarty_template->config_dir + = Template::get_template_config($this->template_set_id, 'smarty_config_dir'); + + // note that we do not use Smarty's template_dir + // because SquirrelMail has its own method of + // determining template file paths + // + //$this->smarty_template->template_dir = } @@ -120,6 +109,35 @@ FIXME: Proposed idea to add a parameter here that turns variable } + /** + * Clears the values of all assigned varaiables. + * + */ + function clear_all_assign() { + + $this->smarty_template->clear_all_assign(); + + } + + /** + * Returns assigned variable value(s). + * + * @param string $varname If given, the value of that variable + * is returned, assuming it has been + * previously assigned. If not specified + * an array of all assigned variables is + * returned. (optional) + * + * @return mixed Desired single variable value or list of all + * assigned variable values. + * + */ + function get_template_vars($varname=NULL) { + + return $this->smarty_template->get_template_vars($varname); + + } + /** * Appends values to template variables *