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}-->
原文地址:https://www.cnblogs.com/zhicheng/p/4387297.html