muban大师 发表于 2018-8-15 08:32:25

织梦子栏目调用currentstyle属性不支持typeid指定ID解决方案

很多站长在用织梦CMS系统制作网站时,经常会用到channel标签来调子栏目,但有的时候需要调用指定栏目的字栏目,而且还需要配合currentstyle属性做当前字栏目高亮的功能,但是织梦默认情况下是currentstyle对typeid是无效的。今天织梦模版网就跟大家分享一下解决方法。
       
               
       
                修改include/taglib/channel.lib.php
       
               
       
                找到:
       
               
       
                if( ($row['id',==$typeid || ($topid==$row['id', && $type=='top') ) && $currentstyle!='' ) //大概在108行左右
       
               
       
                替换成
       
               
       
                if( ( $row['id',== $refObj->TypeLink->TypeInfos['id', || ($topid==$row['id', && $type=='top') ) && $currentstyle!='' )
       
               
       
                调用标签:
       
               
       
                {dede:channel   typeid ='3' type ='son' currentstyle="[*,"}
       
               
       
                  [*,
       
               
       
               {/dede:channel}
       
               
       
                效果:当前栏目下的列表会添加一个class="on"属性,可以配合css样式做当前栏目高亮效果,如图:


https://www.adminbuy.cn/uploads/allimg/180815/1-1PQ50S412261.png
页: [1]
查看完整版本: 织梦子栏目调用currentstyle属性不支持typeid指定ID解决方案