<?php
/*
  按时间排序的分页显示文件
*/
require_once('conn.php');
require_once('smarty.php');
include_once('header.php');
 if(!isset($_GET['year'])||$_GET['year']==null){//获取年份
 	echo "查询错误！";
 }else {
 	$year=$_GET['year'];
 }
  if(!isset($_GET['month'])||$_GET['month']==null){//获取月份
 	echo "查询错误！";
 }else {
 	$month=$_GET['month'];
 }
   if(!isset($_GET['page'])||$_GET['page']==null){//获得页数
    $page=1;
 }else {
 	$page=$_GET['page'];
 }
 $sql="select * from news where year(addtime)=$year and month(addtime)=$month order by addtime desc ";//检索数据库中年份等于传过来的年份，月份等于传过来的文章，按照添加时间降序排列。
 $url="timeList.php?year=$year&month=$month&";
 $pageSize=5;
 require_once('page.class.php');
 $pager=new page($sql,$pageSize,$url,$page,$conn);
 $smarty->assign('row',$pager->getPage());
 $smarty->assign('pageBar',$pager->pageBar());
 $smarty->display('timeList.html');
include_once('serch.php');
include_once('sidebarName.php');
include_once('sidebarTime.php');
include_once('siderbarRecommend.php');
include_once('footer.php');
mysql_close($conn);
?>