/**
  * 构造函数
  *
  * @param Application $app
  */
 function __construct(&$app)
 {
     parent::__construct(&$app);
     $this->smarty = new Smarty();
     isset($app->cfg['smarty']['template_dir']) && ($this->smarty->template_dir = $app->cfg['smarty']['template_dir']);
     isset($app->cfg['smarty']['compile_dir']) && ($this->smarty->compile_dir = $app->cfg['smarty']['compile_dir']);
     isset($app->cfg['smarty']['config_dir']) && ($this->smarty->config_dir = $app->cfg['smarty']['config_dir']);
     isset($app->cfg['smarty']['cache_dir']) && ($this->smarty->cache_dir = $app->cfg['smarty']['cache_dir']);
     isset($app->cfg['smarty']['debugging']) && ($this->smarty->debugging = $app->cfg['smarty']['debugging']);
     isset($app->cfg['smarty']['caching']) && ($this->smarty->caching = $app->cfg['smarty']['caching']);
     isset($app->cfg['smarty']['cache_lifetime']) && ($this->smarty->cache_lifetime = $app->cfg['smarty']['cache_lifetime']);
     isset($app->cfg['smarty']['left_delimiter']) && ($this->smarty->left_delimiter = $app->cfg['smarty']['left_delimiter']);
     isset($app->cfg['smarty']['right_delimiter']) && ($this->smarty->right_delimiter = $app->cfg['smarty']['right_delimiter']);
     $this->smarty->plugins_dir = SMARTY_DIR . 'plugins/';
     $this->smarty->assign_by_ref('cfg', $app->cfg);
     $this->smarty->register_modifier('html', '_htmlspecialchars');
     //设置默认的图片、样式、JS的模版路径
     $this->value('url_js', $app->cfg['url']['js']);
     $this->value('url_images', $app->cfg['url']['images']);
     $this->value('url_css', $app->cfg['url']['css']);
     $this->value('site_title', $app->cfg['site']['title']);
 }
Beispiel #2
0
 /**
  * 构造函数
  *
  * @param Application $app
  */
 function __construct(&$app)
 {
     parent::__construct(&$app);
 }
Beispiel #3
0
 /**
  * 返回application的page对象,第一次调用时会自动根据配置文件自动创建实例
  * @param string $engine Page引擎,默认按application.cfg.php中的
  * 						  $cfg['page']['engine']设置
  * @return APageFactory
  */
 function page($engine = NULL)
 {
     if (!isset($this->pool['page'])) {
         import('plugins.page.APageFactory');
         $engine === NULL && ($engine = $this->cfg['page']['engine']);
         $this->pool['page'] = APageFactory::create($this, $engine);
     }
     return $this->pool['page'];
 }