在織夢系統(tǒng)中的artlist有時候需要當(dāng)前文章高亮,或者和channelartlist標(biāo)簽套用實現(xiàn)當(dāng)前欄目高亮和當(dāng)前文章高亮,就可以通過此方法實現(xiàn):
首先實現(xiàn)artlist當(dāng)前文章高亮:
打開include\taglib\arclist.lib.php
在
$channelid = $ctag->GetAtt('channelid');
下增加:
$currentstyle = $ctag->GetAtt('currentstyle');
在
$tagid,$pagesize,$isweight
后增加
,$currentstyle
在
$noflag='',$tagid='', $pagesize=0, $isweight='N'
后增加
,$currentstyle=''
在
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
下增加
if($currentstyle && $row['id']==$arcid){
$currentstyle = str_replace('~typelink~', $row['filename'], $currentstyle);
$row['currentstyle'] = str_replace('~typename~', $row['title'], $currentstyle);
}
模板調(diào)用:
							
 
 
 
 
 
 
 
 
  | 
					
如果和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'] = '';
}
網(wǎng)上找到的一般沒有加$typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']
添加這個后才能對二級欄目也起作用
調(diào)用方法:
{dede:channelartlist typeid='2' currentstyle='current'}
<li class='{dede:field.currentstyle/}'><a href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a></li>
{/dede:channelartlist}
如果是當(dāng)前欄目則 li的class屬性顯示current,否則顯示class='' ,也可以修改currentstyle='這里改為你需要的類名'。
這樣調(diào)用:
							
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  | 
					




