Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('smarty.php');
     $this->compile_dir = $this->config->item('smarty', 'compile_dir') ?: APPPATH . 'var/template_c';
     $this->template_dir = $this->config->item('smarty', 'template_dir') ?: APPPATH . 'views/templates';
     $this->_wrap = $this->config->item('smarty', 'wrap') ?: false;
     $this->_ext_vars = array();
     // Test the compiled templates directory, create if necessary
     file_exists($this->compile_dir) or mkdir($this->compile_dir, DIR_WRITE_MODE, true);
     // Test the template directory
     if (!is_dir($this->template_dir)) {
         Exception::error('Template directory does not exist');
     }
     // Assign some common variable to smarty
     $this->_smarty = new BaseSmartyWHMCS();
     // WHMCS version of smarty
     $this->_smarty->caching = $this->config->item('smarty', 'caching') ?: 0;
     $this->_smarty->debugging = $this->config->item('smarty', 'debugging') ?: true;
     $this->_smarty->compile_dir = $this->compile_dir;
     $this->_smarty->template_dir = $this->template_dir;
     $this->_smarty->assign('APPPATH', APPPATH);
     $this->_smarty->assign('BASEPATH', BASEPATH);
     $this->log->write('debug', "Smarty Class Initialized");
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('view.php');
     $this->template_dir = $this->config->item('view', 'template_dir') ?: APPPATH . 'views/templates';
     $this->_wrap = $this->config->item('view', 'wrap') ?: false;
     $this->_ext_vars = array();
     // Test the template directory
     if (!is_dir($this->template_dir)) {
         Exception::error('Template directory does not exist');
     }
 }