你這個是要判斷是否有三級欄目,有三級欄目的時候輸出樣式,下面標紅代碼就是判斷是否有三級欄目的代碼
描述:輸出復(fù)雜的三個層級欄目(這里用到channel標簽層次嵌套,注意屬性id | name的用法)
{eyou:channel type='top' row='10' id='field1' currentstyle='active'} // 第一級欄目循環(huán)開始<li>
<a href="{$field1.typeurl}" title="{$field1.typename}" class="{$field1.currentstyle}">
{$field1.typename}
{eyou:notempty name='$field1.children'}
有子欄目時才顯示這里的html代碼,比如:箭頭、圖標等
{/eyou:notempty}
</a>
{eyou:notempty name='$field1.children'} // 判斷是否有子欄目(第二級欄目)start
<div>
{eyou:channel name='$field1.children' id='field2' row='10'} //第二級欄目循環(huán)開始
<div>
<a href="{$field2.typeurl}" class="dropdown-item ">{$field2.typename}</a>
<ul class="{eyou:notempty name='$field2.children'} 樣式{/eyou:notempty} ">
{eyou:channel name='$field2.children' id='field3' row='10'} //第三級欄目循環(huán)開始
<a href="{$field3.typeurl}" class="dropdown-item ">{$field3.typename}</a>
{/eyou:channel} //第三級欄目循環(huán)結(jié)束
</ul >
</div>
{/eyou:channel} // 第二級欄目循環(huán)結(jié)束
</div>
{/eyou:notempty} // 判斷是否有子欄目(第二級欄目)end
</li>
{/eyou:channel} //第一級欄目循環(huán)結(jié)束