求助双循环loop怎么写?子栏目循环里面包含每个子栏目的内容循环。

614次浏览 更新日期:2021-06-26 17:01:18 分类:问题求助 评论:2

求助双循环loop怎么写?子栏目循环里面包含每个子栏目的内容循环。

我现在子栏目的内容循环已经写好了,就是外的的大循环(子栏目循环)不知怎么写才好。最好是在子栏目循环时还能显示子栏目名

{m:lists url,catid="$catid" page="page" order="catid asc" limit="3"}
            {loop $data $v}
            <div class="mb20">
                <h3 class="title">
                    <b>{get_catname($catid)}b>
                    <div class="tagWrap">
                        <a class="item" href="{SITE_URL}navigation/" target="_blank">更多>a>
                    div>
                h3>
                   <div class="navWrapper">
                    {m:lists field="id,title,url,nav_url,thumb,color,de ion" catid="$catid" order="catid asc" limit="12" page="page"}
                    {loop $data $v}
                    <div class="itemArticle">
                        <a class="contentWrap" href="{$v[nav_url]}" title="{$v[de ion]}" target="_blank">
                            <div class="topWrap">
                                <img class="img" src="{get_thumb($v['thumb'])}" alt="{$v[title]}" title="{$v[title]}" />
                                <div class="textBox">
                                    <h2>{$v[title]}h2>
                                    <p>
                                        <span class="btmWrap">{str_cut($v['de ion'], 160)}span>
                                    p>
                                div>
                            div>
                        a>
                    div>
                    {/loop}
                div>
            div>
            {/loop} 

出来的效果是image.png



我想要的参考效果是这样的image.png



我来说两句
  • KNWJ
    KNWJ 1月前
    搞了半天原来官文文档里就有,哎自己还是得多看多学习

    http://doc.yzmcms.com/pindao.html
    1
    回复
  • KNWJ
    KNWJ 1月前
    现在栏目名循环搞定了,栏目内容怎么保存与栏目名一起分配呢?

    {php $data = get_childcat(6);}
    {loop $data $k=>$v}
    <div class="mb20">
    <h3 class="title">
    <b>{$v[catname]}</b>
    <div class="tagWrap">
    <a class="item" href="{$v[pclink]}" target="_blank">更多></a>
    </div>
    </h3>
    <div class="navWrapper">
    {m:lists field="id,title,url,nav_url,thumb,color,description" catid="$catid" order="catid asc" limit="12" page="page"}
    {loop $data $v}
    <div class="itemArticle">
    <a class="contentWrap" href="{$v[nav_url]}" title="{$v[description]}" target="_blank">
    <div class="topWrap">
    <img class="img" src="{get_thumb($v['thumb'])}" alt="{$v[title]}" title="{$v[title]}" />
    <div class="textBox">
    <h2>{$v[title]}</h2>
    <p>
    <span class="btmWrap">{str_cut($v['description'], 160)}</span>
    </p>
    </div>
    </div>
    </a>
    </div>
    {/loop}
    </div>
    </div>
    {/loop}
    0
    回复
作者信息
发布见解
发内容 回顶部