/** * 构造函数 * * @param string $viewBasePath 视图文件的根目录,为空时默认为:"Application/Views/Script/" */ public function __construct($viewBasePath = null) { // 初始化模板根目录 parent::__construct($viewBasePath); // APP配置 $appCfg = QP_Sys::getAppCfg(); // 是否安装了 SMARTY 库文件 $smartyFile = QUICKPHP_PATH . '/Smarty/Smarty/Smarty.class.php'; if (!file_exists($smartyFile)) { throw new QP_Exception('<hr/> 请到 <a href="http://http://www.smarty.net/download" target="_blank">Smarty 官网</a> 或到 <a href="http://www.vquickphp.com" target="_blank">QuickPHP 官网</a> 下载 Smarty 放到 QuickPHP/Smarty/Smarty 目录下 <br/> 注意:<font color="red">只支持 Smarty 2 Releases 的版本</font>(足够用啦,Smarty 3.x 没研究过它^_^) <hr/>'); } // 创建 SMARTY 对象 require_once $smartyFile; $this->_smarty = new Smarty(); // 左/右 标记定义 $this->_smarty->left_delimiter = self::LEFT_DELIMITER; $this->_smarty->right_delimiter = self::RIGHT_DELIMITER; // 编译文件目录 $this->_smarty->compile_dir = APPLICATION_PATH . '/Data/Temp'; // 是否强行编译 $this->_smarty->force_compile = $appCfg['debug']; // 赋于视图中全局的对象 $this->_smarty->assign('request', QP_Request::getInstance()); }
/** * 构造函数 * * @param string $viewBasePath 视图文件的根目录,为空时默认为:"Application/Views/Script/" * @return void */ public function __construct($viewBasePath = null) { parent::__construct($viewBasePath); }