问题一、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:field name='typename'/}。。。{/dede:channelartlist} 如果是当前栏目则 li的class属性显示current,否则显示class='' ,也可以修改currentstyle='这里改为你需要的类名'。
也可以与arclist标签相结合使用,
这样调用:
{dede:channelartlist typeid='2' currentstyle='current'}{dede:field name='typename'/}{dede:arclist titlelen='42' row='10' current}[field:array runphp='yes']if(@me['currentstyle']){@me = @me['currentstyle'];}else{@me = "{@me['title']}";}[/field:array]{/dede:arclist}{/dede:channelartlist}问题二、织梦channel标签currentstyle样式无效不起作用
我们在用织梦系统制作网站时,经常会用到channel标签来调子栏目。但是,很多朋友会遇到这种情况在使用channel标签来调子栏目的时候,指定 “type=son typeid=x” 发现currentstyle无效。今天笔者就跟大家分享一下解决方法。
1、解决channel标签currentstyle样式无效不起作用的错误方法
代码如下:
{dede: type='son' typeid='12' currentMicrosoft YaHei";'> 解决的办法:把typeid=‘12’改为channel=‘1’ (文章模型id),首页除外,其他页面不需要指定typeid=x,会自动判断当前位置。 解决方法如下:{dede: type='son' channel='1' currentmargin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";">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样式无效不起作用的问题。 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
来源:互联网
免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作! |
|