<?php
class singleAction extends FirstendAction {	
	public function _initialize() {
        parent::_initialize();		
		
		$map['status'] = 1;
		$catelist = D('article_cate')->where($map)->order('ordid asc')->select();
		foreach ($catelist as $key => $val) {
			$catelist[$key] = $val;
		}		
		$this->assign('catelist', $catelist);	
		$res = D('article_cate')->field('id,name,ename')->select();
		$cate_list = array();
            foreach ($res as $val) {
                $cate_list[$val['id']] = array($val['name'],$val['ename']);
            }
		$this->_catelist = 	$cate_list;					
    }	
	
	
    public function index(){		
		$alias = I('alias');
		$config_file = CONF_PATH . 'index/config.php';
        $config = include $config_file;	
		$where['type'] = $config['DEFAULT_THEME'];
		$where['alias'] = $alias;
		$where['pass'] = 1;
		$item = D('auto_tpl')->where($where)->find();		
		if(!$item){
		$this->_404();	
		}
		$page_seo=array(
			'title' => $item['name'],
			'keywords' => $item['tags'],
			'description' => $item['intro'],
        );
		$this->assign('page_seo', $page_seo);	
		$this->assign('item',$item);
		$this->assign('navcur',$alias);		
		$this->display();			
		}
}
