コード例 #1
0
ファイル: controller.php プロジェクト: asmari/zcosp
 /**
  * Inisialisasi controller
  * @param String $access = 'site' atau 'admin'
  * @param Boolean $debug, $cache = smarty config
  * @param Integer $cache_lifetime = smarty config
  * @access protected  
  */
 protected function init($access, $link = '', $debug = false, $cache = false, $cache_lifetime = 120)
 {
     self::$instance = $this;
     $this->load = new Z_Loader();
     $this->base_link = base_link_format($link);
     load_file(ENGINE_PATH . 'smarty' . DS . 'libs' . DS, 'Smarty.class.php');
     if (!class_exists('Smarty')) {
         die('Smarty class not found !');
     }
     $this->view = new Smarty();
     if ($access == 'site') {
         $name = $this->theme_dir('site_theme_name', 'site');
         $this->view->template_dir = $this->theme_dir('site_theme_path', 'site');
     } else {
         if ($access == 'admin') {
             $name = $this->theme_dir('site_theme_name', 'admin');
             $this->view->template_dir = $this->theme_dir('site_theme_path', 'admin');
         } else {
             die('Wrong access !');
         }
     }
     $this->view->compile_dir = TEMP_PATH . 'smarty' . DS . 'templates_c' . DS;
     $this->view->config_dir = TEMP_PATH . 'smarty' . DS . 'configs' . DS;
     $this->view->cache_dir = TEMP_PATH . 'smarty' . DS . 'cache' . DS;
     $this->view->plugins_dir = ENGINE_PATH . 'plugin' . DS . 'smarty' . DS . 'plugins' . DS;
     $this->view->debugging = $debug;
     $this->view->caching = $cache;
     $this->view->cache_lifetime = $cache_lifetime;
     $this->require_files($access);
     $this->view->assign('THEME_DIR', $name);
 }