/** * 初始化 * @see CController::init() */ public function init() { parent::init(); //前端控制器在此获得分类,从顶级分类(0)开始分层往下取,得到所有层次的分类 // ppr(XXcache::system('_catalog')); //这里是遍历出来未按照从属排序 // ppr($this->_catalog); //这里重新按从属排序 $this->_catalog = Catalog::get(0, XXcache::system('_catalog')); //系统配置 $this->_conf = XXcache::system('_config'); $this->_seoTitle = $this->_conf['seo_title']; $this->_seoKeywords = $this->_conf['seo_keywords']; $this->_seoDescription = $this->_conf['seo_description']; if ($this->_conf['site_status'] == 'close') { self::_closed(); } $this->_thisUrl = higu(); if ($this->_conf['cache_page_status'] == 'open') { $value = Yii::app()->cache->get($this->_thisUrl); if ($value === false) { echo 'nocache'; } else { echo 'cache'; echo $value; } } }
/** * 初始化 * @see CController::init() */ public function init() { parent::init(); //检测系统是否已经安装 if (!is_file(WWWPATH . DS . 'data' . DS . 'install.lock')) { $this->redirect(array('/install')); } //系统配置 $this->_conf = XXcache::system('_config'); $this->_catalog = Catalog::get(0, XXcache::system('_catalog')); $this->_seoTitle = $this->_conf['seo_title']; $this->_seoKeywords = $this->_conf['seo_keywords']; $this->_seoDescription = $this->_conf['seo_description']; if ($this->_conf['site_status'] == 'close') { self::_closed(); } }
/** * 取单条记录 * @param $catalog * @param array $array */ public static function item($id, array $array = array()) { if (empty($id)) { return; } $eachArr = empty($array) ? XXcache::system('_catalog', 86400) : $array; foreach ((array) $eachArr as $row) { if ($row['id'] == $id) { return $row; } } }