织梦二级栏目增加高亮样式

织梦二级菜单被点击栏目高亮调用方法:

第一步:因为织梦默认dede:channelartlist标签是不支持currentstyle属性的,所以接加下先修改channelartlist.lib.php

1:打开include\taglib\channelartlist.lib.php,找到 $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);

2:在$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);下增加如下代码

1  $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
2                       if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){  
3                          $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'navOn';  
4                           }  
5                         else{  
6                         $pv->Fields['currentstyle'] = '';  
7                          }  

第二步:前台调用:

 1 {dede:channelartlist   typeid='47,58,59,70,71,60'  currentstyle='nav_active' }
 2             <li class="{dede:field.currentstyle/}">
 3                 <a href="{dede:field name='typeurl'/}">
 4                     <h1>{dede:field name='typename'/}</h1>
 5                     <!-- <h2>ABOUT</h2> -->
 6                     <dl>
 7                     {dede:channel type='son' noself='yes' }
 8                             <a href="[field:typelink/]">
 9                                 <dd>
10                                     <span>
11                                         <b>-</b>
12                                     </span>[field:typename/]<span>
13                                         <b>-</b>
14                                     </span>
15                                 </dd>
16                             </a>
17                     {/dede:channel}
18                     </dl>
19                 </a>
20             </li>
21 {/dede:channelartlist} 
currentstyle='nav_active'
class="{dede:field.currentstyle/}"

 

 

转载于:https://www.cnblogs.com/php-qiuwei/p/11410208.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值