完美解決織夢(mèng)channelartlist標(biāo)簽不支持currentstyle屬性
POST TIME:2020-09-05
打開(kāi)include\taglib\channelartlist.lib.php
找到
-
1 |
$pv->Fields[ 'typeurl' ] = GetOneTypeUrlA($typeids[$i]); |
|
在此行代碼下方增加以下代碼:
1 |
if ($typeids[$i][ 'id' ] == $refObj->TypeLink->TypeInfos[ 'id' ] || |
2 |
$typeids[$i][ 'id' ] == $refObj->TypeLink->TypeInfos[ 'topid' ] ){ |
3 |
$pv->Fields[ 'currentstyle' ] = $currentstyle ? $currentstyle : 'current' ; |
6 |
$pv->Fields[ 'currentstyle' ] = '' ; |
|
網(wǎng)上找到的一般沒(méi)有加$typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']
添加這個(gè)后才能對(duì)二級(jí)欄目也起作用
調(diào)用方法:
1 |
{dede:channelartlist typeid= '2' currentstyle= 'current' } |
2 |
<li class= '{dede:field.currentstyle/}' ><a href= '{dede:field name=' typeurl '/}' > |
3 |
{dede:field name= 'typename' /}</a></li> |
|
如果是當(dāng)前欄目則 li的class屬性顯示current,否則顯示class='' ,也可以修改currentstyle='這里改為你需要的類名'。