<?php
/*
   按分类显示的文件
*/
require_once('conn.php');
require_once('smarty.php');
include_once('header.php');
  $pageSize=10;//设置每页显示10条
    if(!isset($_GET['catId'])||$_GET['catId']==null){//判断是否获得catId,没有设置则令$catId为1，否则就等于获得值
  	$catId=1;
  }else{
  	$catId=$_GET['catId'];
  }
  $sql = "select * from news where parentId=$catId order by addtime desc ";//设置sql语句为按时间降序的parent等于catId的文章
  $url="catList.php?catId=$catId&";//设置分页用的url地址
  if(!isset($_GET['page'])||$_GET['page']==null){//判断是否获得page,没有设置则令$page为1，否则就等于获得值
  	$catId=1;
  	$page=1;
  }else{
  	$page=$_GET['page'];
  }
  require_once('page.class.php');//包含smarty分页类
  $pager=new page($sql,$pageSize,$url,$page,$conn);//实例化类
  $smarty->assign('row',$pager->getPage());//获得分页数据
  $smarty->assign('pageBar',$pager->pageBar());//显示分页工具栏
  $smarty->display('catList.html');//在模板页显示
  include_once('serch.php');
  include_once('sidebarName.php');
  include_once('sidebarTime.php');
  include_once('siderbarRecommend.php');
  include_once('footer.php');
  mysql_close($conn);
  ?>