織夢二級菜單被點擊欄目高亮調用方法:php
第一步:由於織夢默認dede:channelartlist標籤是不支持currentstyle屬性的,因此接加下先修改channelartlist.lib.phpurl
1:打開include\taglib\channelartlist.lib.php,找到 $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);spa
2:在$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);下增長以下代碼code
1 $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]); 2 if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){ 3 $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'navOn'; 4 } 5 else{ 6 $pv->Fields['currentstyle'] = ''; 7 }
第二步:前臺調用:blog
1 {dede:channelartlist typeid='47,58,59,70,71,60' currentstyle='nav_active' } 2 <li class="{dede:field.currentstyle/}"> 3 <a href="{dede:field name='typeurl'/}"> 4 <h1>{dede:field name='typename'/}</h1> 5 <!-- <h2>ABOUT</h2> --> 6 <dl> 7 {dede:channel type='son' noself='yes' } 8 <a href="[field:typelink/]"> 9 <dd> 10 <span> 11 <b>-</b> 12 </span>[field:typename/]<span> 13 <b>-</b> 14 </span> 15 </dd> 16 </a> 17 {/dede:channel} 18 </dl> 19 </a> 20 </li> 21 {/dede:channelartlist}
currentstyle='nav_active'
class="{dede:field.currentstyle/}"