從模型表中取出字段,進(jìn)行分割。并且判斷當(dāng)前URL是否包含該條件。
下面這段代碼是放在模板里面的。
<?php $topurl=urldecode($_SERVER["QUERY_STRING"]);//獲取當(dāng)前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>'; //當(dāng)前點(diǎn)擊過來的條件 } $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>'; //當(dāng)前點(diǎn)擊過來的條件 } $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>'; //當(dāng)前點(diǎn)擊過來的條件 } $mysql=$empire->query("select fvalue from {$dbtbpre}enewsf where f='rzzt'");//認(rèn)證評級 $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>'; //當(dāng)前點(diǎn)擊過來的條件 } ?> <p class="yule_tiaojian"> <p class="yule_ico_pingtai"><p class="yule_ico_01 yule_ico_left">游戲平臺:</p> <p class="yule_ico_right"> <ul><?=$yxpt?></ul> </p> </p> <p class="yule_ico_pingtai"> <p class="yule_ico_02 yule_ico_left">游戲類型:</p> <p class="yule_ico_right"> <ul><?=$yxlx?></ul> </p> </p> <p class="yule_ico_pingtai"><p class="yule_ico_03 yule_ico_left">安全保障:</p> <p class="yule_ico_right"> <ul><?=$aqbz?></ul> </p> </p> <p class="yule_ico_pingtai"><p class="yule_ico_04 yule_ico_left">認(rèn)證評級:</p> <p class="yule_ico_right"> <ul><?=$xjct?></ul> </p> </p> </p>
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";//判斷是否包含當(dāng)前連接 } $url=$_SERVER["QUERY_STRING"];//當(dāng)前URL $rexp="&"; $shang=explode($rexp,$url); $count=count($shang); for($i=0;$i<$count;$i++) { $tiaojian= "&".$shang[$i]; //當(dāng)前點(diǎn)擊過來的條件 } $pos = intval(strpos($topurl,$tiaojian));//判斷當(dāng)前URL是否已經(jīng)包含了條件 if($pos=="0") { $path=$topurl.$tiaojian; } else { $path=str_replace($tiaojian,'',$topurl); } echo "<script>location.href='$path'</script>"; ?>
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 帝國CMS結(jié)合項(xiàng)多條件篩選可多選