织梦CMS channelartlist标签也支持當前栏目高亮的方法
熟悉dede的朋友都知道channel标签的高亮功能dede自带的.
默认cha
更多精彩就在: 51免费论文网|www.jxszl.com
nnel标签代码:
{dede:channeltype=’top’row=’I.0’currentstyle="
{/dede:channel}
说明:当前栏目高亮的样式是:class=’hover’
下面就跟大家分享下让织梦channelartlist标签也支持当前栏目高亮方法,
找到并打开include/taglib/channelartlist.lib.php文件,在里面找到下面这段代码:
$pv->Fields[‘typeurl’]=GetOneTypeUrlA($typeids[$i]);
在此行代码下方增加以下代码:
//让channelartlist支持栏目高亮Bydedejs.comII0I.IV/I.0/I.IX
if($typeids[$i][‘id’]==$refObj->TypeLink->TypeInfos[‘id’]){
$pv->Fields[‘currentstyle’]=‘class="hover"‘;
}
else{
$pv->Fields[‘currentstyle’]=";
}
然后在模板文件中的channelartlist标签里面通过{dede:fieldname=’currentstyle’/}调用即可,此字段输出的内容就是上面$pv->Fields[‘currentstyle’]=‘class="hover"‘;中的class="hover".
原文链接:http://www.jxszl.com/biancheng/dedecms/74842.html
热门阅读