<?php
function exhibition($ar)
{
	global $db,$cache,$cachetime,$config,$buid,$tpl;
	useCahe();
	$flag=md5(implode(",",$ar));
	$tmpdir=$config['webroot']."/templates/".$config['temp']."/label/".$ar['temp'].".htm";
	if(file_exists($tmpdir))
		$tpl->template_dir = $config['webroot']."/templates/".$config['temp']."/label/";
	else
		$tpl->template_dir = $config['webroot']."/templates/default/label/";
	$ar['temp']=empty($ar['temp'])?'exhibition_default':$ar['temp'];
	if(!$tpl->is_cached($ar['temp'].".htm",$flag))
	{	
		$limit=$ar['limit'];
		$rec=$ar['rec'];//是否调用推荐的展会
		$img=$ar['img'];  //img
		$country=$ar['country'];  //国家
		$nowtime=time();
		$sub_sql=NULL;
		if(!empty($rec))
			$sub_sql.=" and statu>='$ar[rec]'";
		if(!empty($img))
			$sub_sql.=" and pic !=''";
			
		$sql="select id,stime,etime,addTime,title,pic from ".EXHIBIT."  where 1 $sub_sql order by id desc limit 0, $limit";
		$db->query($sql);
		$re=$db->getRows();
		//==================================================
		$tpl->assign("config",$config);
		$tpl->assign("exhibition",$re);
	}
	return $tpl->fetch($ar['temp'].'.htm',$flag);
}
?>