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