<?php
class sblog_topicControl extends skymvc{
	
	public function __construct(){
		parent::__construct();
	}
	public function onDefault(){
		$where="status=1";
		$type=get("type","h");
		switch($type){
			case "all":
				break;
			default:
				$where.=" AND isrecommend=1 ";
				break;
		}
		$start=get("per_page","i");
		$limit=48;
		$rscount=true;
		$topicList=M("mod_sblog_topic")->select(array(
			"where"=>$where,
			"limit"=>$limit,
			"start"=>$start
		),$rscount);
		$per_page=$start+$limit;
		$per_page=$per_page<$rscount?$per_page:0;
		$this->smarty->goAssign(array(
			"topicList"=>$topicList,
			"per_page"=>$per_page
		));
		$this->smarty->display("sblog_topic/index.html");
	}
	
}
?>