找到include/taglib/channelartlist.lib.php 大约93行找到如下代码:
$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'] = ''; }
前台调用方式:
{dede:channelartlist typeid='top' currentstyle="active"} <li class="navitem"> <a class="{dede:field.currentstyle/}" href="{dede:field%20name='typeurl'/}" target="_self"> {dede:field name='typename'/}</a> </li> {/dede:channelartlist}
这样只要是当前栏目就会自动添加active类,从而实现导航高亮显示
Warning: A non-numeric value encountered in /www/wwwroot/www.wangdahai.cn/wp-content/themes/dux/modules/mo_comments_list.php on line 63
这样的博客让人禁不住一天来几次!