如何在筛选页调用出扩展资源、版本两个筛选数据

发布于 2020-07-26 17:31:21

如何在筛选页调用出“扩展资源、扩展版本”两个筛选数据

我试过把“type_extend.class” 改成 “type_extend.state” 但前端没显示数据出来

<ul class="mcat_nav_wide_5 clearfix">
            <li class="mcat_nav_wide_1 text_li"><a class="font16 text_999" href="">类型</a></li>
            {empty name="$obj.type_extend.class"}
            {maccms:foreach name=":explode(',',$obj.parent.type_extend.class)"}{if condition="$key lt 20"}
            <li class="box_list_10 text_li"><a href="{:mac_url_type($obj,['area'=>$param['area'],'lang'=>$param['lang'],'year'=>$param['year'],'level'=>$param['level'],'letter'=>$param['letter'],'state'=>$param['state'],'tag'=>$param['tag'],'class'=>$vo,'order'=>$param['order'],'by'=>$param['by'] ],'show')}" title="{$vo}">{$vo}</a></li>
            {/if}{/maccms:foreach}
            {else/}
            {maccms:foreach name=":explode(',',$obj.type_extend.class)"}{if condition="$key lt 20"}
            <li class="box_list_10 text_li"><a href="{:mac_url_type($obj,['area'=>$param['area'],'lang'=>$param['lang'],'year'=>$param['year'],'level'=>$param['level'],'letter'=>$param['letter'],'state'=>$param['state'],'tag'=>$param['tag'],'class'=>$vo,'order'=>$param['order'],'by'=>$param['by'] ],'show')}" title="{$vo}">{$vo}</a></li>
            {/if}{/maccms:foreach}
            {/empty}
        </ul>

比如图片
QQ图片20200726173045.png

查看更多

关注者
0
被浏览
65
2 个回答
金刚狼
金刚狼 2020-07-26
官方技术人员
{maccms:foreach name=":explode(',',$obj.type_extend.version)"}
    {if condition="$key lt 20"}
         <li><a href="{:mac_url_type($obj,['area'=>$param['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'],'version'=>$vo ],'show')}" title="{$vo}">{$vo}</a>
         </li>
    {/if}
{/maccms:foreach}

原理是:
把 $obj.type_extend.version 字符串变量转换为数组,然后使用 maccms:foreach 循环遍历;

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览