注册 登录 欢迎您到模板精:织梦模板_dede模板_免费网站模板_网站源码下载

织梦教程_免费织梦模板下载_dede模板

该栏目分享织梦建站的基础知识,从织梦CMS的安装,到织梦标签的常规调用,以及织梦的常见问题答疑都有涉及。

当前位置:首页 > 织梦教程 >

织梦channelartlist标签不支持currentstyle属性怎么办

免费网站模板 2020-09-16 09:42 织梦教程 评论
织梦channelartlist标签不支持currentstyle属性怎么办 。打开include aglibchannelartlist.lib.php
找到
 
$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);  
 
在此行代码下方增加以下代码:
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] ||
 $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){  
             $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';  
         }  
         else{  
             $pv->Fields['currentstyle'] = '';  
         }  
   
 
网上找到的一般没有加$typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']
添加这个后才能对二级栏目也起作用
调用方法:
{dede:channelartlist typeid='2' currentstyle='current'}  
 <li class='{dede:field.currentstyle/}'><a href='{dede:field name='typeurl'/}'>
{dede:field name='typename'/}</a></li>  
 。。。  
 {/dede:channelartlist}  
   
 
 
如果是当前栏目则 li的class属性显示current,否则显示class='' ,也