您的位置:老铁SEO > 站长新闻 > 网站技术 >

软文代写伪原创 织梦dede如何让channelartlist标签支持currentstyle属性

文章来源:http://www.6cu.com

作者:外链论坛

人气:11

2021-05-12 20:08:30

织梦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'] = '';

        }
 

调用方法:

{dede:channelartlist typeid='2' currentstyle='current'}

<li class='{dede:field.currentstyle/}'><a href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a></li>

{/dede:channelartlist}
 

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

相关文章

在线客服

外链咨询

扫码加我微信

微信:juxia_com

返回顶部