帝国CMS结合项多条件筛选可多选

从模型表中取出字段,进行分割。并且判断当前URL是否包含该条件。
下面这段代码是放在模板里面的。

<?php
$topurl=urldecode($_SERVER[QUERY_STRING]);//获取当前URL后缀
$mysql=$empire->query(select fvalue from {$dbtbpre}enewsf where f='yxpt');//游戏平台
$r=$empire->fetch($mysql);
$rexp=|;
$fvalue=explode($rexp,$r['fvalue']);
$count=count($fvalue);
for($i=0;$i<$count;$i++)
{
$str=yxpt=.$fvalue[$i];
$strpos = intval(strpos($topurl,$str));
if($strpos==0)
{
$yangshi=' class=yule_off';
}
else
{
$yangshi=' class=yule_on';
}
$yxpt .= '<li'.$yangshi.'><a href='.$public_r[newsurl].'e/extend/url/form.php?tempid=3&mid=10&ph=1&yxpt='.$fvalue[$i].'>'.$fvalue[$i].'</a></li>'; //当前点击过来的条件
}
$mysql=$empire->query(select fvalue from {$dbtbpre}enewsf where f='yxlx');//游戏类型
$r=$empire->fetch($mysql);
$rexp=|;
$fvalue=explode($rexp,$r['fvalue']);
$count=count($fvalue);
for($i=0;$i<$count;$i++)
{
$str=yxlx=.$fvalue[$i];
$strpos = intval(strpos($topurl,$str));
if($strpos==0)
{
$yangshi=' class=yule_off';
}
else
{
$yangshi=' class=yule_on';
}
$yxlx .= '<li'.$yangshi.'><a href='.$public_r[newsurl].'e/extend/url/form.php?tempid=3&mid=10&ph=1&yxlx='.$fvalue[$i].'>'.$fvalue[$i].'</a></li>'; //当前点击过来的条件
}
$mysql=$empire->query(select fvalue from {$dbtbpre}enewsf where f='aqbz');//安全保障
$r=$empire->fetch($mysql);
$rexp=|;
$fvalue=explode($rexp,$r['fvalue']);
$count=count($fvalue);
for($i=0;$i<$count;$i++)
{
$str=aqbz=.$fvalue[$i];
$strpos = intval(strpos($topurl,$str));
if($strpos==0)
{
$yangshi=' class=yule_off';
}
else
{
$yangshi=' class=yule_on';
}
$aqbz .= '<li'.$yangshi.'><a href='.$public_r[newsurl].'e/extend/url/form.php?tempid=3&mid=10&ph=1&aqbz='.$fvalue[$i].'>'.$fvalue[$i].'</a></li>'; //当前点击过来的条件
}
$mysql=$empire->query(select fvalue from {$dbtbpre}enewsf where f='rzzt');//认证评级
$r=$empire->fetch($mysql);
$rexp=|;
$fvalue=explode($rexp,$r['fvalue']);
$count=count($fvalue);
for($i=0;$i<$count;$i++)
{
$str=rzzt=.$fvalue[$i];
$strpos = intval(strpos($topurl,$str));
if($strpos==0)
{
$yangshi=' class=yule_off';
}
else
{
$yangshi=' class=yule_on';
}
$xjct .= '<li'.$yangshi.'><a href='.$public_r[newsurl].'e/extend/url/form.php?tempid=3&mid=10&ph=1&rzzt='.$fvalue[$i].'>'.$fvalue[$i].'</a></li>'; //当前点击过来的条件
}
?>
<div class=yule_tiaojian>
<div class=yule_ico_pingtai><div class=yule_ico_01 yule_ico_left>游戏平台:</div>    
<div class=yule_ico_right>
<ul><?=$yxpt?></ul>
</div>
</div>
<div class=yule_ico_pingtai>
<div class=yule_ico_02 yule_ico_left>游戏类型:</div>
<div class=yule_ico_right>
<ul><?=$yxlx?></ul>
</div>
</div>
<div class=yule_ico_pingtai><div class=yule_ico_03 yule_ico_left>安全保障:</div>
<div class=yule_ico_right>
<ul><?=$aqbz?></ul>
</div>
</div>
<div class=yule_ico_pingtai><div class=yule_ico_04 yule_ico_left>认证评级:</div>
<div class=yule_ico_right>
<ul><?=$xjct?></ul>
</div>
</div>
</div>

e/extend/url/form.php 代码如下

<?php
$topurl=$_SERVER['HTTP_REFERER'];//获取顶级链接
$strurl=ph=1;
$strbh=intval(strpos($topurl,$strurl));
if($strbh==0)
{
$topurl=$public_r[newsurl].e/action/ListInfo.php?tempid=3&mid=10&ph=1;//判断是否包含当前连接
}
$url=$_SERVER[QUERY_STRING];//当前URL
$rexp=&;
$shang=explode($rexp,$url);
$count=count($shang);
for($i=0;$i<$count;$i++)
{
$tiaojian= &.$shang[$i]; //当前点击过来的条件
}
$pos = intval(strpos($topurl,$tiaojian));//判断当前URL是否已经包含了条件
if($pos==0)
{
$path=$topurl.$tiaojian;
}
else
{
$path=str_replace($tiaojian,'',$topurl);        
}
echo <script>location.href='$path'</script>;
?>