没头没脑没烦恼 發表於 2024-3-22 00:00:00

织梦dedecms首页导航栏currentstyle参数无效的替代方法

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        默认织梦的首页没有设置高亮属性,只要其他栏目可以。以下代码可以解决这个问题:<br>
         <br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode1" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        &lt;/p&gt; &lt;p&gt;&lt;li{dede:field name=typeid runphp="yes"}<br>
        (@me=="")? @me=" class='hover'":@me="";{/dede:field}&gt;<br>
        &lt;a href='{dede:global.cfg_cmsurl/}/'&gt;&lt;span&gt;主页&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br>
        {dede:channel type='top' row='10' current}<br>
        &lt;li&gt;&lt;a href='' &gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br>
        {/dede:channel}&lt;/p&gt; &lt;p&gt;</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        以上蓝色加粗的代码就是判断当前栏目是否是首页,如果是首页则加上class='hover',否则就不加,以此来达到想要的效果。</p>
頁: [1]
查看完整版本: 织梦dedecms首页导航栏currentstyle参数无效的替代方法