织梦dede如何让channelartlist标签支持currentstyle属性
来源:小码王信奥 时间:2024-10-16 浏览量:45

织梦dede如何让channelartlist标签支持currentstyle属性?

织梦dede让channelartlist标签支持currentstyle属性

推荐学习:织梦cms

打开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'] = '';
        }

调用方法:

{dede:channelartlist typeid='2' currentstyle='current'}
<li class=&#39;{dede:field.currentstyle/}&#39;><a href=&#39;{dede:field name=&#39;typeurl&#39;/}&#39;>{dede:field name=&#39;typename&#39;/}</a></li>
{/dede:channelartlist}

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

以上就是织梦dede如何让channelartlist标签支持currentstyle属性的详细内容,更多请关注本网内其它相关文章!

免责申明:以上展示内容来源于合作媒体、企业机构、网友提供或网络收集整理,版权争议与本站无关,文章涉及见解与观点不代表小码王官方立场,请读者仅做参考。本文标题:织梦dede如何让channelartlist标签支持currentstyle属性,本文链接:http://www.xiaomawang.vip/help/11096.html;欢迎转载,转载请说明出处。若您认为本文侵犯了您的版权信息,或您发现该内容有任何涉及有违公德、触犯法律等违法信息,请您立即通过邮件(邮箱号: hzlixy@xiaoma.cn)联系我们及时修正或删除。