目前織夢模板里currentstyle只支持dede:channel,這種只能調取一層欄目,而我們建站時,在導航欄里經常要調用到一級和二級欄目,然后讓當前欄目高亮,使用特殊樣式,要用到dede:channelartlist。
現在的織夢currentstyle在dede:channelartlist里中無法使用的,需要我們自己添加一些代碼才行。
1、找到“/include/taglib/channelartlist.lib.php”這個文件;? ? ? ? ? 【推薦學習:織夢cms】
2、找到這行代碼“$pv->Fields[‘typeurl’] = GetOneTypeUrlA($typeids[$i]);”
3、在這行代碼后復制以下代碼:
if($typeids[$i]['id']?==?$refObj->TypeLink->TypeInfos['id']?||?$typeids[$i]['id']?==?$refObj->TypeLink->TypeInfos['topid']?){????$pv->Fields['currentstyle']?=?$currentstyle???$currentstyle?:?'?class="on"';}????else{????$pv->Fields['currentstyle']?=?'';}
4、調用方法:
{dede:channelartlist?typeid='top'}
{/dede:channelartlist}
這樣就可以在調取所有欄目的dede:channelartlist標簽里使用currentstyle了。
其中:3、里面的 class=”on” 就是在當前欄目里加的樣式,可以把on修改為自己想要的。
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END