0

苹果cms开启假墙防御后搜索页筛选页的选项参数如何高亮展示

李峰
2022-11-26 2399

为了防御假墙我们把url参数编码方式或空白方式处理掉了。关闭假墙防御就不会出现这个问题。

那么原来使用搜索页面、分类筛选页面的模板可能需要做有些简单调整才能正确显示筛选高亮。 在模板头部插入定义变量(在调用$pp变量之前插入就可以) {php}$pp = mac_param_url(); {/php} 然后把原来判断高亮的代码修改一下即可,把$param 替换为 $pp 即可, 来看例子。

未修改的地区筛选:

<a {if condition="$param['area'] eq ''"} class="current" {/if} href="{:mac_url_type($obj,['area'=>'','lang'=>$param['lang'],'year'=>$param['year'],'level'=>$param['level'],'letter'=>$param['letter'],'state'=>$param['state'],'tag'=>$param['tag'],'class'=>$param['class'],'order'=>$param['order'],'by'=>$param['by'] ],'show')}">全部

{empty name="$obj.type_extend.area"}
{maccms:foreach name=":explode(',',$obj.parent.type_extend.area)" id="vo2" key="key2"}
<a {if condition="$param['area'] eq $vo2"} class="current" {/if} href="{:mac_url_type($obj,['area'=>$vo2,'lang'=>$param['lang'],'year'=>$param['year'],'level'=>$param['level'],'letter'=>$param['letter'],'state'=>$param['state'],'tag'=>$param['tag'],'class'=>$param['class'],'order'=>$param['order'],'by'=>$param['by'] ],'show')}">{$vo2}

{/maccms:foreach}
{else /}
{maccms:foreach name=":explode(',',$obj.type_extend.area)" id="vo2" key="key2"}
<a {if condition="$param['area'] eq $vo2"} class="current" {/if} href="{:mac_url_type($obj,['area'=>$vo2,'lang'=>$param['lang'],'year'=>$param['year'],'level'=>$param['level'],'letter'=>$param['letter'],'state'=>$param['state'],'tag'=>$param['tag'],'class'=>$param['class'],'order'=>$param['order'],'by'=>$param['by'] ],'show')}">{$vo2}

{/maccms:foreach}
{/empty}

修改后的代码是:

<a {if condition="$pp['area'] eq ''"} class="current" {/if} href="{:mac_url_type($obj,['area'=>'','lang'=>$pp['lang'],'year'=>$pp['year'],'level'=>$pp['level'],'letter'=>$pp['letter'],'state'=>$pp['state'],'tag'=>$pp['tag'],'class'=>$pp['class'],'order'=>$pp['order'],'by'=>$pp['by'] ],'show')}">全部
{empty name="$obj.type_extend.area"} {maccms:foreach name=":explode(',',$obj.parent.type_extend.area)" id="vo2" key="key2"}
<a {if condition="$pp['area'] eq $vo2"} class="current" {/if} href="{:mac_url_type($obj,['area'=>$vo2,'lang'=>$pp['lang'],'year'=>$pp['year'],'level'=>$pp['level'],'letter'=>$pp['letter'],'state'=>$pp['state'],'tag'=>$pp['tag'],'class'=>$pp['class'],'order'=>$pp['order'],'by'=>$pp['by'] ],'show')}">{$vo2}
{/maccms:foreach} {else /} {maccms:foreach name=":explode(',',$obj.type_extend.area)" id="vo2" key="key2"}
<a {if condition="$pp['area'] eq $vo2"} class="current" {/if} href="{:mac_url_type($obj,['area'=>$vo2,'lang'=>$pp['lang'],'year'=>$pp['year'],'level'=>$pp['level'],'letter'=>$pp['letter'],'state'=>$pp['state'],'tag'=>$pp['tag'],'class'=>$pp['class'],'order'=>$pp['order'],'by'=>$pp['by'] ],'show')}">{$vo2}
{/maccms:foreach} {/empty}

 

最新回复 (0)

    暂无评论

请先登录后发表评论!

返回
请先登录后发表评论!