首页 > CMS > 织梦DEDE > 正文

织梦模板channelartlist实现高亮并且让嵌套标签里的channel也支持currentstyle高亮

2024-07-12 08:49:05
字体:
来源:转载
供稿:网友
这篇文章主要为大家详细介绍了织梦模板channelartlist实现高亮并且让嵌套标签里的channel也支持currentstyle高亮,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。

      织梦模板channelartlist实现高亮并且让嵌套标签里的channel也支持currentstyle高亮,这个效果很多童鞋可能没有遇见过,但是真是做织梦模板的用户早晚都会碰到,尤其是一些目录比较深的网站经常会碰到,如何实现呢?

一、dede:channelartlist当前栏目高亮实现教程

打开 /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['reid'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] || $typeids[$i]['id'] == GetTopid($refObj->TypeLink->TypeInfos['id']) ){$pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';}else{$pv->Fields['currentstyle'] = '';}

然后 dede:channelartlist 标签里是高亮标签调用是

{dede:field.currentstyle/}

嵌套标签

<div class="nav">    <ul>        {dede:channelartlist row=7 typeid=top currentstyle=current}        <li class="{dede:field.currentstyle/}">            <a href="{dede:field.typeurl/}">{dede:field.typename/}</a>            <ul>                {dede:channel type='son' noself='yes' row='10' currentstyle="<li class='hover'><a href='~typelink~'>~typename~</a></li>"}                <li><a href="[field:typeurl/]">[field:typename/]</a></li>                {/dede:channel}            </ul>        </li>        {/dede:channelartlist}    </ul></div>

实现教程

打开 /include/taglib/channel.lib.php 找到

global $dsql;

改成

global $dsql,$_sys_globals;

继续找到

$row['id']==$typeid

改成

$row['id']==$typeid || $row['id']==$_sys_globals['typeid']
以上就是织梦模板channelartlist实现高亮并且让嵌套标签里的channel也支持currentstyle高亮的全部内容,希望对大家的学习和解决疑问有所帮助,也希望大家多多支持武林网。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表