<?php
/*
  侧边栏显示按时间显示
*/
 $timeQuery="SELECT count(*) as num,year(addtime) as year,month(addtime) as month FROM `news` group by month(addtime)*year(addtime) order by month(addtime) desc limit 0,10";//按照添加时间的年份乘以月份分组，按照添加时间的月份降序排列，检索数据条目数，添加时间的年份，添加时间的月份，检索头10条记录
 $timeResult=mysql_query($timeQuery,$conn);
 while ($timeRow1=mysql_fetch_array($timeResult)) {
 	$timeRow[]=$timeRow1;
 }
 foreach ($timeRow	as $key=>$value){
	     $timeRow[$key]=$value;
        }
 //echo "<pre>";
 //print_r($timeRow);
 //echo "</pre>";
 
 $smarty->assign('timeRow',$timeRow);
 $smarty->display('sidebarTime.html');
?>