diff --git a/framework/src/Maveriks/Pattern/Mvc/SmartyView.php b/framework/src/Maveriks/Pattern/Mvc/SmartyView.php index e1240537c..94620fe07 100644 --- a/framework/src/Maveriks/Pattern/Mvc/SmartyView.php +++ b/framework/src/Maveriks/Pattern/Mvc/SmartyView.php @@ -1,34 +1,59 @@ smarty = new \Smarty(); - $this->smarty->compile_dir = defined('PATH_SMARTY_C')? PATH_SMARTY_C : sys_get_temp_dir(); - $this->smarty->cache_dir = defined('PATH_SMARTY_CACHE')? PATH_SMARTY_CACHE : sys_get_temp_dir(); + // Instance Smarty class + $this->smarty = new Smarty(); - if (! is_dir($this->smarty->compile_dir)) { + // Set Smarty temporal paths + $this->smarty->compile_dir = defined('PATH_SMARTY_C') ? PATH_SMARTY_C : sys_get_temp_dir(); + $this->smarty->cache_dir = defined('PATH_SMARTY_CACHE') ? PATH_SMARTY_CACHE : sys_get_temp_dir(); + + // If the paths don't exist we need to create them + if (!is_dir($this->smarty->compile_dir)) { Common::mk_dir($this->smarty->compile_dir); } - if (! is_dir($this->smarty->cache_dir)) { + if (!is_dir($this->smarty->cache_dir)) { Common::mk_dir($this->smarty->cache_dir); } } - public function assign($name, $value) + /** + * Assign a value to a Smarty piece in the template + * + * @param string $name + * @param mixed $value + * + * @return void + */ + public function assign($name, $value = null) { $this->smarty->assign($name, $value); } + /** + * Render the Smarty template + */ public function render() { $this->smarty->display($this->getTpl());