聯系官方銷售客服
1835022288
028-61286886
模板標簽里面
程序版本:V4.5.2 Bulid 2021-09-03
請教如何調用 導航欄目,并且有 current功能(當前頁面顯示 class=“on”)?
頂級欄目,這樣寫是沒啥問題的
{category module=share pid=0}
<a href="{$t.url}" {if dr_in_array($catid, $t.catids)} class="on"{/if}>
{$t.name}
</a>
{/category}
但是放到二級欄目后,current功能無法顯現
<div class="subnav mg tr mbox">
<span class="circle"></span>
{category module=share pid=$t.id return=t2}
<a href="{$t2.url}" {if dr_in_array($catid, $t2.catids)} class="on"{/if}>{$t2.name} </a>
{/category}
</div>
另外想請教下 pid和 return 有什么作用,有啥區別么?
理論上一樣有效啊,你這種判斷是很標準的,用于欄目列表頁面
pid是調用指定父類下面的子類
renturn用于區分內外循環的變量前綴
{category module=share pid=$t.id return=t2}
這個意思是調用所有的二級欄目嘛?
如果我是想 調用 一級欄目ID=5 名下的 所有二級欄目應該如何操作呢?
{category module=share pid=5 return=t2} 這樣寫貌似不行的
{category module=share pid=$t.id return=t2}這個不是調用所有的二級欄目
他是調用上一層循環的下級欄目,$t是上一層循環的變量
--------------
ID=5 名下的 所有下級級欄目
{category module=share pid=5 return=t2} 這樣寫是ok的
回復@官方研發技術-阿華 您好,我再請教下,如何調用 單獨欄目id下的名稱和鏈接:
dede中這樣寫
{dede:type typeid='8'}
<dt>[field:typename/]</dt>
{/dede:type}