织梦二级菜单被点击栏目高亮调用方法:
第一步:因为织梦默认dede:channelartlist标签是不支持currentstyle属性的,所以接加下先修改channelartlist.lib.php
1:打开include aglibchannelartlist.lib.php,找到 $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
2:在$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);下增加如下代码
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 }
第二步:前台调用:
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/}"