栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

dede:channelartlist currentstyle高亮显示

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

dede:channelartlist currentstyle高亮显示

我们在用DEDECMS建站时,常常会做二级栏目的功能,既要用到二级栏目,也就要通过DEDE标签再套标签的方式来实现调用,而DEDECMS多层标签调用只支持channelartlist,也就是说我们只能通过dede:channelartlist标签才能调出二级栏目,我们用dede: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、调用方法:

{dede:channelartlist typeid='top'}

{dede:field name='typename'/}

{/dede:channelartlist}

决dede:channelartlist标签无法使用currentstyle的问题。

另外需要注意的是这段代码中,请不要自作聪明的加上class="{dede:field.currentstyle/}",因为最先加的一段代码中就判断了,如果是当然栏目,系统就会自动输出“ class='current'”,照本文原样复制,即可解决这个问题。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/4326.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号