响应式广告位

如何判断顶级栏目,如果有下级就不带链接,没有下级就带链接!

群里有人问如何判断顶级栏目,如果有下级就不带链接,没有下级就带链接!简单写下

如何判断顶级栏目,如果有下级就不带链接,没有下级就带链接!

其实就是用notempty判断下级是不是有子栏目,如果有子栏目就调用子栏目,同时顶级栏目链接写个空链接,反之没有子栏目的 就写上链接。
上代码:
 {eyou:channel type=”top” row=”60″ id=”field” currentstyle=”background:#0976dc”}
        {eyou:notempty name=”$field.children”}
        <li class=”menu”><a href=”javacript:void(0);” style=”{$field.currentstyle}”>{$field.typename}</a>
          <ul class=”sub”>
            {eyou:channel name=”$field.children” row=”100″ id=”field1″}
            <li><a href=”{$field1.typeurl}”>{$field1.typename}</a> </li>
            {/eyou:channel}
          </ul>
          <span></span> </li>
        {eyou:else /}
        <li><a href=”{$field.typeurl}” style=”{$field.currentstyle}”>{$field.typename}</a></li>
        {/eyou:notempty}
        {/eyou:channel}

© 版权声明
THE END
喜欢就支持一下吧
点赞919 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容