destoon任何页面实现自定义筛选的方法


来源: https://destoon.cc/ 时间: 2019-03-01 22:16:09 人气: 558 评论: 0

任何页面实现自定义筛选,不二开内核文件,全部在模板中实现,不影响升级,不使用搜索功能。

DT二开请加QQ:346655709

首页在页头引入jquery
for(var i = 0; i < result
return result;
}

function goSort(name,value){
var string_array = getQueryString();
var oldUrl = (document
}

//如果没有重复的筛选字段
if(repeatField == false){
newUrl = oldUrl+"&"+name+"="+value;
}

}else{//如果还没有筛选条件
newUrl = oldUrl+"?"+name+"="+value;
}

//跳转
window


function setSelected(name,value){
var all_li = $("#"+name));
//为选中的a增加now类
all_li

$(document)
});
</script>

然后在模板中引入条件语句,这下面的是筛选条件,看不懂的先学学,参考修改。
{php $condition = "status=3";}
{php $dmode = array('',1=>" and price=0",2=>" and price>0");}
{php $dcatid = array('',1=>" and catid=10",2=>" and catid=11");}
{php $dprice = array('',1=>" and price<1001",2=>" and price>1000 and price<2000",3=>" and price>2001 and price<3000",4=>" and price>3001 and price<5000",5=>" and and price>5001 and price<10001",6=>" and price>10000");}
{php $order = isset($order) ? intval($order) : 0;}
{php $mode = isset($mode) ? intval($mode) : 0;}
{php $dorder = array('addtime desc','price desc','hits desc');}
{php $condition
{php $condition
{php $condition
{php $condition

筛选模板,仅供参考

<div class="left j-left wfs fz12">
<h3 class="template">收费模式<span class="hide-left j-hide-left" style=""><i></i></span></h3>
<div class="icons j-icons wfs" id="mode">
<a class="now" href="javascript:goSort('mode',0);">全部</a>
<a href="javascript:goSort('mode',1);">商业模板</a>
<a href="javascript:goSort('mode',2);">免费模板</a>
</div>
<h3 class="template">模板类型<span class="hide-left j-hide-left" style=""><i></i></span></h3>
<div class="icons j-icons wfs" id="catid">
<a class="now" href="javascript:goSort('catid',0);">全部</a>
<a href="javascript:goSort('catid',1);">平台型</a>
<a href="javascript:goSort('catid',2);">小众型</a>
</div>
<h3 class="template">价格<span class="hide-left j-hide-left" style=""><i></i></span></h3>
<div class="icons j-icons wfs price" id="price">
<li> <a class="now" href="javascript:goSort('price',0);">全部</a></li>
<li> <a href="javascript:goSort('price',1);">1000以下</a></li>
<li><a href="javascript:goSort('price',2);">1000-2000</a></li>
<li> <a href="javascript:goSort('price',3);">2000-3000</a></li>
<li> <a href="javascript:goSort('price',4);">3000-5000</a></li>
<li> <a href="javascript:goSort('price',5);">5000-10000</a></li>
<li> <a href="javascript:goSort('price',6);">10000以上</a></li>
</div>


</div>

</div>

<div class="right j-right" style="margin-left: 300px;">
<div class="sort wfs">
<div style="float:left;">
<span style="margin-left:45px; float:left; padding-top:5px; font-size:12px;">排序:</span>

<span class="sort-icons j-sort-icons" id="order">
<a class="now" rel="nofollow" href="javascript:goSort('order',0);">新品</a>
<a rel="nofollow" href="javascript:goSort('order',1);">价格</a>
<a rel="nofollow" href="javascript:goSort('order',2);">热销</a>
</span>

</div>

</div>

循环语句中&condition=后面加入上$condition
大功 告成。



destoon任何页 二开教程

评论
346655709