dede:channelartlist currentstyle高亮顯示

咱們在用DEDECMS建站時,經常會作二級欄目的功能,既要用到二級欄目,也就要經過DEDE標籤再套標籤的方式來實現調用,而DEDECMS多層標籤調用只支持channelartlist,也就是說咱們只能經過dede:channelartlist標籤才能調出二級欄目,咱們用dede:channelartlist能順利的將信息調出來,可是若是咱們要設置當前所在欄目高亮顯示的功能時,currentstyle屬性將不起做用,下面咱們就來解決channelartlist currentstyle高亮顯示的問題。php

一、找到「/include/taglib/channellartlist.php」這個文件;url

二、找到這行代碼「$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);」class

三、在這行代碼後複製如下代碼:if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){    $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : ' class="current"';}    else{    $pv->Fields['currentstyle'] = '';}channel

四、調用方法:{dede:channelartlist typeid='top'}<li{dede:field.currentstyle/}><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a></li>{/dede:channelartlist}方法

以上4步,完美解決dede:channelartlist標籤沒法使用currentstyle的問題。top

另外須要注意的是<li{dede:field.currentstyle/}>這段代碼中,請不要自做聰明的加上class="{dede:field.currentstyle/}",由於最早加的一段代碼中就判斷了,若是是固然欄目,系統就會自動輸出「 class='current'」,照本文原樣複製,便可解決這個問題。文件

相關文章
相關標籤/搜索