<?php
/*
  显示搜索结果页
*/
require_once('conn.php');
require_once('smarty.php');
include_once('header.php');
 $pageSize=5;
    if(!isset($_GET['keyword'])||$_GET['keyword']==null){
  	echo "</br><br><div align=\"center\"><font color=\"red\">请先输入关键词！</font></div><hr>";
  }else{
  	$keyword=$_GET['keyword'];
  $sql = "select * from news where title like '%".$keyword."%' order by addtime desc ";//检索数据库中匹配标题的文章显示
  $url="serchList.php?keyword=$keyword&";
  if(!isset($_GET['page'])||$_GET['page']==null){
  	$page=1;
  }else{
  	$page=$_GET['page'];
  }
  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('serchList.html');
  }
include_once('serch.php');
include_once('sidebarName.php');
include_once('sidebarTime.php');
include_once('siderbarRecommend.php');
include_once('footer.php');
mysql_close($conn);
?>