欢迎访问2017年洛阳SEO牛广的官方博客,只要标题有亲测有效的都是原创文章。为大家提供最新真实有效的案例,承接网站SEO百度优化业务QQ:939380096

DEDECMS主菜单和子菜单双选中高亮效果代码—亲测有效

dede niuguang 963次浏览 8个评论

洛阳SEO 牛广 学习dede仿站笔记 实现 主菜单和子菜单双选中高亮效果 这个在网站制作中使用非常频繁。

如图下:

dede

废话不多讲 请看下文操作方法。

1) 找到dede系统文件

文件位置为 include\taglib\channelartlist.lib.php

打开后找到查找下面代码

$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]); 

2) 在此行代码下方增加以下代码:

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

 保存关闭文件。

 3) 在模板里面调用代码

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

   typeid=”这个里面写对应的二级id编号”,(就是要显示的二级菜单) 列如   typeid=”7,8,9,10″

   currentstyle=”这个里面写选择后的class样式名称”      列如    currentstyle=”hover” 

   其他不需要修改,然后去后台 更新栏目缓存 一键更新网站。 

    以上内容由洛阳SEO 牛广真情送上 http://www.xiaoguangseo.com


小广 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明DEDECMS主菜单和子菜单双选中高亮效果代码—亲测有效
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到
(8)个小伙伴在吐槽
  1. This actually answered my downside, thanks! [url=http://www.cheapoakleys.name]cheap oakley sunglasses[/url]
    匿名2018-08-13 09:32 (5天前)
  2. It抯 laborious to search out knowledgeable folks on this matter, however you sound like you understand what you抮e talking about! Thanks tom ford sunglasses [url=http://www.tomfordsunglasses.us.org]tom ford sunglasses[/url]
    匿名2018-08-14 03:00 (4天前)
  3. Your home is valueble for me. Thanks!? yeezy 500 [url=http://www.yeezy500.us]yeezy 500[/url]
    匿名2018-08-14 15:36 (4天前)
  4. I intended to create you a very little word so as to give thanks over again with the incredible things you've shared on this website. It was certainly generous with people like you to deliver extensively precisely what some people might have supplied for an e book to earn some cash for their own end, most importantly considering that you could have done it if you ever considered necessary. Those tips additionally acted as a fantastic way to recognize that other individuals have the same eagerness similar to my very own to know the truth significantly more with regards to this condition. I'm certain there are some more fun times ahead for people who discover your blog post. yeezy boost [url=http://42.herber.pl/yeezyshoes]yeezy boost[/url]
    匿名2018-08-16 00:04 (2天前)
  5. An fascinating discussion is price comment. I feel that you must write extra on this topic, it might not be a taboo subject however generally persons are not enough to speak on such topics. To the next. Cheers chrome hearts [url=http://www.chromehearts.name]chrome hearts[/url]
    匿名2018-08-16 02:49 (2天前)
  6. Thanks a lot for giving everyone remarkably wonderful chance to read in detail from this blog. It can be so useful and as well , full of a good time for me and my office acquaintances to visit your web site the equivalent of 3 times a week to learn the new stuff you have got. And lastly, I'm certainly astounded considering the breathtaking strategies served by you. Certain two tips in this article are certainly the finest we have had. Adidas NMD Runner PK Black Grey [url=http://www.adidas-nmds.us.com/adidas-nmd-runner-pk-black-grey-p-36.html]Adidas NMD Runner PK Black Grey[/url]
    匿名2018-08-17 03:00 (1天前)
  7. The next time I learn a blog, I hope that it doesnt disappoint me as a lot as this one. I imply, I know it was my choice to read, however I really thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about something that you possibly can repair when you werent too busy on the lookout for attention. van shoes [url=http://www.vans-shoes.us.org]van shoes[/url]
    匿名2018-08-17 11:49 (23小时前)
  8. WONDERFUL Post.thanks for share..extra wait .. ? adidas eqt [url=http://www.adidas-eqt.us.com]adidas eqt[/url]
    匿名2018-08-18 04:46 (6小时前)