DedeCms 标签中channelartlist设置属性标签样式的方法

实现的效果如下:

{dede:channelartlist typeid='6' row='3' currentstyle='current'}
    <li class='{dede:field.currentstyle/}'>
        <a href='{dede:field name='typeurl'/}'>
            {dede:field name='typename'/}
        </a>
    </li>
{/dede:channelartlist}

打开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'] = '';
}

 

posted @ 2023-02-08 10:42  冷晨  阅读(59)  评论(0编辑  收藏  举报