<?php
//------------------------------------------
if(empty($_GET['m'])||empty($_GET['s']))
	die('forbiden;');
//-------------------------------------------
useCahe();
$flag=md5($dpid.$dcid.$config["temp"].$_COOKIE["langtw"]);
if(!$tpl->is_cached("exhibition_index.htm",$flag))
{
	include_once("includes/page_utf_class.php");
	$key=!empty($_GET["key"])?trim($_GET["key"]):NULL;
	$firstRow=!empty($_GET["firstRow"])?$_GET["firstRow"]:NULL;
	$totalRows=!empty($_GET["totalRows"])?$_GET["totalRows"]:NULL;
	$sub_sql=NULL;
	
	if(!empty($_GET['key']))
		$sub_sql.=" and (title like '%$key%' or tag like '%$key%')";
	$sql="select * from ".EXHIBIT." where statu>=1 $sub_sql order by addtime desc";
	//---------------
	$page = new Page;
	$page->listRows=10;
	$page->url=$config['weburl'].'/';
	if (!$page->__get('totalRows')){
		$db->query($sql);
		$page->totalRows = $db->num_rows();
	}
	$sql .= "  limit ".$page->firstRow.",".	$page->listRows;
	//----------------
	$db->query($sql);
	$re["page"]=$page->prompt();
	$re["list"]=$db->getRows();
	foreach($re["list"] as $key=>$val)
	{
		$re["list"][$key]["tags"]=explode(',',$val["tag"]);
	}
	$tpl->assign("re",$re);

}
$tpl->assign("current","exhibition");
include_once("footer.php");
$out=tplfetch("exhibition_index.htm",$flag);
?>