DedeCMS让channelartlist支持currentstyle属性

DedeCMS让channelartlist支持currentstyle属性,第1张

概述dedecms默认模板的channelartlist是不支持currentstyle属性的。currentstyle属性在导航中应用的比较多,可以实现循环调用栏目后,当前页li标签获得一个class=自定义命名的属性,具体作用就不做说明了,需要修改文件。 打开include\taglib\channelartlist.lib

    Dedecms默认模板的channelartList是不支持currentstyle属性的。currentstyle属性在导航中应用的比较多,可以实现循环调用栏目后,当前页 打开include\taglib\channelartList.lib.PHP

找到:

$pv->FIElds['typeurl'] = GetoneTypeUrlA($typeIDs[$i]);
在此行代码下方增加以下代码:
//让channelarcList支持currentstyle属性        if($typeIDs[$i]['ID'] == $refObj->Typelink->TypeInfos['ID'] || $typeIDs[$i]['ID'] == $refObj->Typelink->TypeInfos['topID'] ){               $pv->FIElds['currentstyle'] = $currentstyle ? $currentstyle : 'nli on';           }           else{               $pv->FIElds['currentstyle'] = 'nli';           }  //让channelarcList支持currentstyle属性end

       网上找到的一般没有加$typeIDs[$i]['ID'] ==$refObj->Typelink->TypeInfos['topID']

       添加这个后才能对二级栏目也起作用。

调用方法:
{dede:channelartList typeID='2' currentstyle='current'}   

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

导航用channelartList调用子栏目方法

       循环调用出的栏目 配合使用 SuperSlIDe可以构建美观的下拉菜单功能

      具体的方法可以参考官方的使用方法,我使用的时候发现,“手动或后台程序添加titOnClassname类名(默认是'on'),相当于设置参数defaultIndex:2。若同时设置参数returnDefault:true,则鼠标移走后返回当前频道。 ”这个功能失效,更新后才能正常使用,但是一定要按照以上步骤进行修改才能让channelartList支持currentstyle属性。下面附修改方法:

include\taglib\channelartList.lib.PHP部分修改为

if($typeIDs[$i]['ID'] == $refObj->Typelink->TypeInfos['ID'] || $typeIDs[$i]['ID'] == $refObj->Typelink->TypeInfos['topID'] ){    $pv->FIElds['currentstyle'] = $currentstyle ? $currentstyle : 'nli on';          }  else{      $pv->FIElds['currentstyle'] = 'nli';  

后台调用部分修改为:

nli on'}             总结       

以上是内存溢出为你收集整理的DedeCMS让channelartlist支持currentstyle属性全部内容,希望文章能够帮你解决DedeCMS让channelartlist支持currentstyle属性所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/1060753.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存