<?php
/**
 * 文章列表内容
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author zhaoh <1070309178@qq.com>
 */
namespace Home\Controller;
use Think\Controller;
class ArticleController extends BaseController {
	public function _initialize(){
		parent::_initialize();
        $this->ArticleCat=getcache('ArticleCat');
    }
    public function index(){
		$id = I('id');if(empty($id))$this->error('参数错误');
		$catinfo=$this->ArticleCat[$id];$this->assign($catinfo);
		
		$map['status']=1;
		$map['catid']=$id;
		$aticle_info=page_list('Article',$map,'sort desc,addtime desc','id,title,addtime',10,'',1);
		$this->assign($aticle_info);
		
        $this->assign('tplseo_title',($catinfo['seotitle']?$catinfo['seotitle']:$catinfo['name']).'_'.C('WEB_SITE_TITLE'));
        $this->assign('tplseo_keywords',empty($catinfo['seokeywords'])?$catinfo['name']:$catinfo['seokeywords']);
        $this->assign('tplseo_description',empty($catinfo['seodescription'])?$catinfo['name']:$catinfo['seodescription']);
		$this->display();
	}
    public function show(){
		$id = I('id');if(empty($id))$this->error('参数错误');
		$info=M('Article')->where('id='.$id)->field(true)->find();
		$this->assign('info',$info);
		
		$catinfo=$this->ArticleCat[$info['catid']];$this->assign($catinfo);
		
        $this->assign('tplseo_title',($info['seotitle']?$info['seotitle']:$info['title']).'_'.$catinfo['name'].'_'.C('WEB_SITE_TITLE'));
        $this->assign('tplseo_keywords',empty($info['seokeywords'])?$info['title']:$info['seokeywords']);
        $this->assign('tplseo_description',empty($info['seodescription'])?$info['title']:$info['seodescription']);
		$this->display();
    }

}
?>