zoukankan      html  css  js  c++  java
  • ecshop怎么全局调用指定文章二级分类(注意是文章分类不是二级商品分类)

    1、直接将以下代码复制到要显示的模板,修改所需文章分类id,其中 {if $cat.id eq 16}的意思是调用文章分类ID为16下的二级文章分类    

    <? $GLOBALS['smarty']->assign('article_categories',   article_categories_tree(0)); //文章分类树 ?>

    <!--{foreach from=$article_categories item=cat}-->
        {if $cat.id eq 16}              
            <!--{foreach from=$cat.children item=child}-->
                <li ><a href="{$child.url}">{$child.name|escape:html}</a></li>
            <!--{/foreach}-->
        {/if}
    <!--{/foreach}-->
     
    2、调用指定文章分类及分类下的子分类
    <? $GLOBALS['smarty']->assign('article_categories',   article_categories_tree(0)); //文章分类 ?>
    <!--{foreach from=$article_categories item=cat}-->
         {if $cat.id eq 16}          
             <a href="{$cat.url}" style="font-weight:bold;">{$cat.name|escape:html}</a>
                 <!--{foreach from=$cat.children item=child}-->
                     <li ><a href="{$child.url}">{$child.name|escape:html}</a></li>
                 <!--{/foreach}-->
         {/if}
    <!--{/foreach}-->
  • 相关阅读:
    大数据基础——MR编程应用——对中间件的操作
    Hadoop_Hive整理——原理及配置
    Hadoop&Hive——小结
    mysql_小结之事务
    Linux_大数据与数据仓库
    移动布局小结
    JDBC——小结
    Mysql优化反刍
    NoSql-Verson1.0
    python-6
  • 原文地址:https://www.cnblogs.com/zhicheng/p/4387297.html
Copyright © 2011-2022 走看看