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

上天赐予了你宝贵的生命,必定要让你在一生中,坚持,奋斗到最后一秒,燃烧尽生命的火焰。

打开include\taglib\channelartlist.lib.php
找到

 
  1. $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);  


在此行代码下方增加以下代码:

if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] ||
 
$typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){  
  1.              $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';  
  2.          }  
  3.          else{  
  4.              $pv->Fields['currentstyle'] = '';  
  5.          }  
  6.    


网上找到的一般没有加$typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']
添加这个后才能对二级栏目也起作用
调用方法:

{dede:channelartlist typeid='2' currentstyle='current'}  
  1.  <li class='{dede:field.currentstyle/}'><a rel="nofollow noopener noreferrer" href='{dede:field name='typeurl'/}'>
  2. {dede:field name='typename'/}</a></li>  
  3.  。。。  
  4.  {/dede:channelartlist}  
  5.    
 


如果是当前栏目则 li的class属性显示current,否则显示class='' ,也可以修改currentstyle='这里改为你需要的类名'。

以上就是完美如何解决织梦channelartlist标签不支持currentstyle属性。但行前路,不负韶华!更多关于完美如何解决织梦channelartlist标签不支持currentstyle属性请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
dedecms5.7版本tag标签无效不支持大写字母怎么办

dedecms 专题列表页不支持[dede:fulltitle]标签的如何解决方法

DedeCMS子栏目调用currentstyle属性不支持typeid的如何解决方案

dedecms模板不支持PHP 函数file_exists

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