迅睿開(kāi)源框架是一款PHP8高性能·簡(jiǎn)單易用的PHP開(kāi)源開(kāi)發(fā)框架, 基于MIT開(kāi)源許可協(xié)議發(fā)布,不限制商業(yè)使用,以多端互聯(lián)為設(shè)計(jì)理念, 支持的微信公眾號(hào)、小程序、APP客戶(hù)端、移動(dòng)端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
業(yè)務(wù)經(jīng)理
微信掃描以上二維碼
028-61286886
在線咨詢(xún)
{category module=share pid=0 return=c1} <li> <a href="{$c1.url}" >{$c1.name}</a> {/category}
這種循環(huán)里面,怎么判斷循環(huán)的主欄目,有沒(méi)有子欄目呢?
官方提醒:使用category欄目循環(huán)標(biāo)簽的生成工具,填寫(xiě)參數(shù)就可以生成相關(guān)的代碼,每個(gè)參數(shù)后面都有用法解釋
這個(gè)pid=0表示循環(huán)頂級(jí)欄目,不循環(huán)子欄目
開(kāi)源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問(wèn)題!
回復(fù)@迅??蚣芗夹g(shù)-田聰明
{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>
是這樣的,我就想判斷循環(huán)的主欄目下,有沒(méi)有子欄目。
{if $cat.child} 當(dāng)前欄目存在子欄目 {/if}
這個(gè)方法只能在:category.html,list.html,show.html中用,如果是要欄目循環(huán)中判斷,應(yīng)該怎么寫(xiě)呢?
{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}
默認(rèn)模板的header.html有現(xiàn)成的代碼啊
這個(gè)pid=0表示循環(huán)頂級(jí)欄目,不循環(huán)子欄目
開(kāi)源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問(wèn)題!
回復(fù)@迅??蚣芗夹g(shù)-田聰明
{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}
是這樣的,我就想判斷循環(huán)的主欄目下,有沒(méi)有子欄目。
{if $cat.child} 當(dāng)前欄目存在子欄目 {/if}這個(gè)方法只能在:category.html,list.html,show.html中用,如果是要欄目循環(huán)中判斷,應(yīng)該怎么寫(xiě)呢?
{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}默認(rèn)模板的header.html有現(xiàn)成的代碼啊