当前位置:网站首页>currentstyle 织梦_dede currentstyle属性完美解决方案
currentstyle 织梦_dede currentstyle属性完美解决方案
2022-08-02 09:48:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
问题一、dede让channelartlist标签支持currentstyle属性 完美解决
打开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’] = ”;
}
网上找到的一般没有加$typeids[$i][‘id’] ==$refObj->TypeLink->TypeInfos[‘topid’]
添加这个后才能对二级栏目也起作用
调用方法:
{dede:channelartlist typeid=’2′ currentstyle=’current’}
。。。
{/dede:channelartlist}
如果是当前栏目则 li的class属性显示current,否则显示class=” ,也可以修改currentstyle=’这里改为你需要的类名’。
————————————————————————————————————————-
也可以与arclist标签(详见:http://www.ifreew.com/a/ym/Dedecms/9191.html)相结合使用,
这样调用:
{dede:channelartlist typeid=’2′ currentstyle=’current’}
{dede:arclist titlelen=’42’ row=’10’ currentstyle=”
[field:array runphp=’yes’]
if(@me[‘currentstyle’]){
@me = @me[‘currentstyle’];
}else{
@me = “
}
[/field:array]
{/dede:arclist}
{/dede:channelartlist}
问题二、织梦channel标签currentstyle样式无效不起作用
我们在用织梦系统制作网站时,经常会用到channel标签来调子栏目。但是,很多朋友会遇到这种情况在使用channel标签来调子栏目的时候,指定 “type=son typeid=x” 发现currentstyle无效。今天笔者就跟大家分享一下解决方法。
1、解决channel标签currentstyle样式无效不起作用的错误方法
代码如下:
{dede: type=’son’ typeid=’12’ currentstyle=”
~typename~ “} [field:typename/]
{/dede:channel}
解决的办法:把typeid=‘12’改为channel=‘1’ (文章模型id),首页除外,其他页面不需要指定typeid=x,会自动判断当前位置。
解决方法如下:
{dede: type=’son’ channel=’1′ currentstyle=”
~typename~ “} [field:typename/]
{/dede:channel}
笔者经测试这种调用方式currentstyle根本是无效的,简直是无稽之谈。
2、解决channel标签currentstyle样式无效不起作用的正确方法修改include/taglib/channel.lib.php
把
if( ($row[‘id’]==$typeid || ($topid==$row[‘id’] && $type==’top’) ) && $currentstyle!=” )
改成
if( ( $row[‘id’]== $refObj->TypeLink->TypeInfos[‘id’] || ($topid==$row[‘id’] && $type==’top’) ) && $currentstyle!=” )
笔者经测试这种调用方式currentstyle有效,可以解决解决channel标签currentstyle样式无效不起作用的问题。
边栏推荐
- Talk about the understanding of Volatile
- Re23:读论文 How Does NLP Benefit Legal System: A Summary of Legal Artificial Intelligence
- SAP 云平台上一种 Low Code Development(低代码开发)解决方案
- 要长续航还是更安全?海豹与深蓝SL03对比导购
- Shell脚本实现多选DNS同时批量解析域名IP地址(新更新)
- 【云原生】快出数量级的性能是怎样炼成的?就提升了亿点点
- 新“内卷”席卷科技圈,Google CEO 要求 174000 员工提高工作效率!
- The realization of the list
- Tencent T8 architect, teach you to learn small and medium R&D team architecture practice PDF, senior architect shortcut
- Spend 2 hours a day to make up for Tencent T8, play 688 pages of SSM framework and Redis, and successfully land on Meituan
猜你喜欢
日元疲软令游戏机在日本变身“理财产品”:黄牛大赚
Re22:读论文 HetSANN An Attention-based Graph Neural Network for Heterogeneous Structural Learning
MySql tens of millions of paging optimization, fast insertion method of tens of millions of data
你认同这个观点吗?大多数企业的数字化都只是为了缓解焦虑
nacos项目搭建
AutoJs学习-实现谢尔宾斯基三角
曲折的tensorflow安装过程(Tensorflow 安装问题的解决)
Implementation of mysql connection pool
适配器模式适配出栈和队列及优先级队列
HikariCP数据库连接池,太快了!
随机推荐
State Management in Jetpack Compose
R语言ggpubr包的ggline函数可视化分组折线图、add参数为mean_se和dotplot可视化不同水平均值的折线图并为折线图添加误差线(se标准误差)和点阵图、自定义palette设置颜色
The ggline function of the R language ggpubr package visualizes grouped line graphs, the add parameter is mean_se and dotplot to visualize line graphs of different level averages, and adds error bars
Talk about the understanding of Volatile
Smoothing of time series data in R language: smoothing time series data to remove noise using the dpill function and locpoly function of the KernSmooth package
向量点积(Dot Product),向量叉积(Cross Product)
牛客网项目2.7开发注册功能 报错This application has no explicit mapping for /error......
Implementation of mysql connection pool
百战RHCE(第四十七战:运维工程师必会技-Ansible学习2-Ansible安装配置练习环境)
稳定币:对冲基金做空 Tether 的结局会是什么?
SAP 云平台上一种 Low Code Development(低代码开发)解决方案
记某社区问答
node制作一个视频帧长图生成器
中国发布丨滴滴因违反网络安全法等被罚80.26亿元!调查细节公布
二维数组零碎知识梳理
李航《统计学习方法》笔记之监督学习Supervised learning
软件测试X模型
The heavyweights are coming!Spoilers for the highlights of the Alibaba Cloud Life Science and Intelligent Computing Summit
单词接龙 II
众城优选系统开发功能