完美解决织梦channelartlist标签不支持currentstyle属性

来源:网络 文章列表 2021-07-25 8
完美解决织梦channelartlist标签不支持currentstyle属性

打开include\taglib\channelartlist.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}

 

腾讯云限量秒杀

1核2G 5M 50元/年 2核4G 8M 74元/年 4核8G 5M 818元/年 CDN流量包 100GB 9元

版权声明

本站部分原创文章,部分文章整理自网络。如有转载的文章侵犯了您的版权,请联系站长删除处理。如果您有优质文章,欢迎发稿给我们!联系站长:
愿本站的内容能为您的学习、工作带来绵薄之力。

评论

  • 随机获取
点击刷新
精彩评论

友情链接