织梦模板dede:channelartlist标签支持currentstyle
织梦dedecms中仅channel支持currentstyle属性,实际使用中往往需要channelartlist添加currentstyle,修改如下:
修改include\taglib\channelartlist.lib.php
第93行$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
新增(其中'ON'为设置的样式类):
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){
$pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'on';
}else{
$pv->Fields['currentstyle'] = '';
}
模板文件中代码:
{dede:channelartlist type='top' row='12' typeid='1,6,15,16,21,25,26,29'"}
<li class="{dede:field.currentstyle/}">
<a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>
<ul class="slide">
{dede:channel type='son' row='12'}
[field:global name=autoindex runphp="yes"](@me==0)? @me="<li><span class='arrow-up'></span></li><li>":@me="<li>";[/field:global]
<a href="[field:typeurl/]">[field:typename/]</a>
</li>
{/dede:channel}
</ul>
</li>
{/dede:channelartlist}