迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發框架,基于MIT開源許可協議發布,免費且不限制商業使用,是免費開源的產品,以萬端互聯為設計理念,支持的微信公眾號、小程序、APP客戶端、移動端網站、PC網站等多終端式管理系統。
聯系官方銷售客服
1835022288
028-61286886
{category module=share pid=0 return=c1} <li> <a href="{$c1.url}" >{$c1.name}</a> {/category}
這種循環里面,怎么判斷循環的主欄目,有沒有子欄目呢?
官方提醒:使用category欄目循環標簽的生成工具,填寫參數就可以生成相關的代碼,每個參數后面都有用法解釋
這個pid=0表示循環頂級欄目,不循環子欄目
回復@迅睿框架技術-田聰明
{category module=share pid=0 return=c1}
<li> <a href="{$c1.url}" class="" >{$c1.name}</a>
<ul >
{category module=share pid=$c1.id return=c2}
<li><a href="{$c2.url}">{$c2.name}</a></li>
{/category}
</ul>
</li>
是這樣的,我就想判斷循環的主欄目下,有沒有子欄目。
{if $cat.child} 當前欄目存在子欄目 {/if}
這個方法只能在:category.html,list.html,show.html中用,如果是要欄目循環中判斷,應該怎么寫呢?
{category module=share pid=0 return=c1} 我是父欄目:{$c1.name}<br> {if $c1.child} 存在子欄目 {category module=share pid=$c1.id return=c2} 我是{$c1.name}的子欄目:{$c2.name}<br> {/category} {/if} {/category}
默認模板的header.html有現成的代碼啊
這個pid=0表示循環頂級欄目,不循環子欄目
回復@迅睿框架技術-田聰明
{category module=share pid=0 return=c1}
<li> <a href="{$c1.url}" class="" >{$c1.name}</a>
<ul >
{category module=share pid=$c1.id return=c2}
<li><a href="{$c2.url}">{$c2.name}</a></li>
{/category}
</ul>
</li>
{/category}
是這樣的,我就想判斷循環的主欄目下,有沒有子欄目。
這個方法只能在:category.html,list.html,show.html中用,如果是要欄目循環中判斷,應該怎么寫呢?
默認模板的header.html有現成的代碼啊