我们在用DEDECMS建站时,常常会做二级栏目的功能,既要用到二级栏目,也就要通过DEDE标签再套标签的方式来实现调用,而DEDECMS多层标签调用只支持channelartlist,也就是说我们只能通过wmd:channelartlist标签才能调出二级栏目,我们用wmd:channelartlist能顺利的将信息调出来,但是如果我们要设置当前所在栏目高亮显示的功能时,currentstyle属性将不起作用,下面我们就来解决channelartlist currentstyle高亮显示的问题。
1、找到“/include/taglib/channelartlist.php”这个文件;
2、找到这行代码:
				$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);  | 
		
3、在这行代码后加入代码:
				
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] )
{   
 $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : ' class="current"';
}    
else{ 
   $pv->Fields['currentstyle'] = '';
}
			 | 
		
4、调用方法:
				
{wmd:channelartlist typeid='top'}
<li{wmd:field.currentstyle/}>
<a href="{wmd:field name='typeurl'/}">{wmd:field name='typename'/}</a>
</li>
{/wmd:channelartlist}
			 | 
		
以上4步,完美解决wmd:channelartlist标签无法使用currentstyle的问题。
另外需要注意的是<li{wmd:field.currentstyle/}>这段代码中,请不要自作聪明的加上class="{wmd:field.currentstyle/}",因为最先加的一段代码中就判断了,如果是当然栏目,系统就会自动输出“ class='current'”,照本文原样复制,即可解决这个问题。
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)