博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
织梦CMS让channelartlist标签支持currentstyle【转】
阅读量:7219 次
发布时间:2019-06-29

本文共 777 字,大约阅读时间需要 2 分钟。

打开include\taglib\channelartlist.lib.php

找到

[php] 
 
  1. $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'] = '';
}

网上找到的一般没有加$typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']

添加这个后才能对二级栏目也起作用
调用方法:

{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}

如果是当前栏目则 li的class属性显示current,否则显示class='' ,也可以修改currentstyle='这里改为你需要的类名'。

转载于:https://www.cnblogs.com/hejia/p/3484511.html

你可能感兴趣的文章
计算机运行命令全集
查看>>
WebSocket 实战
查看>>
二次排序
查看>>
CSS:如何清除a标签之间的默认留白间距
查看>>
selenium随笔
查看>>
leetcode599
查看>>
String类中“==”和“equals()”的区别
查看>>
leetcode--883
查看>>
the application could not be verified
查看>>
[转]Centos配置国内yum源
查看>>
redis数据类型和应用场景
查看>>
Spring IOC
查看>>
Fragment的onCreateView和onActivityCreate之间的区别(转)
查看>>
AC日记——统计难题 hdu 1251
查看>>
在仿真器中运行时跳过Windows Azure Startup任务
查看>>
android 获取路径目录方法以及判断目录是否存在,创建目录
查看>>
数列问题[HAOI2004模拟]
查看>>
2012各大IT公司校招笔试题整理
查看>>
phpcms 后台分页
查看>>
《需求工程》阅读笔记之六
查看>>