dede:channelartlist currentstyle栏目高亮显示方法

channelartlist currentstyle高亮显示的问题,这可用于DEDE织梦模板中导航栏高亮显示。
1、找到“/include/taglib/channellartlist.php”这个文件;
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="current"';}    else{    $pv->Fields['currentstyle'] = '';}
4、 调用方法:{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的问题。
另 外需要注意的是<li{dede:field.currentstyle/}>这段代码中,请不要自作聪明的加上class=" {dede:field.currentstyle/}",因为最先加的一段代码中就判断了,如果是当然栏目,系统就会自动输出“ class='current'”,。

注意:class="current" 里面的current 根据自已网站来填写。

posted @ 2015-03-15 17:06  织梦模板  阅读(465)  评论(0编辑  收藏  举报