目前织梦模板里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']='';}