一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

织梦dedecms二级菜单实现方法

时间:2022-06-25 16:22:01 编辑:袖梨 来源:一聚教程网

例子1

修改channelartlist.lib.php

 代码如下 复制代码

if($typeid==0 || $typeid=='top') {
        $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
    }

修改为

 代码如下 复制代码

if($typeid=='tops') {
        $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 ";
    }elseif($typeid==0 || $typeid=='top') {
        $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
    }

然后页面调用

 代码如下 复制代码

{dede:channelartlist typeid='tops' row=10}
    


  •         {dede:field.typename/}
                   

                        {dede:channel row='10'}
                             
    • [field:typename/]

    •                     {/dede:channel}
             

        

  • {/dede:channelartlist}


    例子2

    首先在你的css里面加入

     代码如下 复制代码

    *          
    {         
        PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
    }         
    A {         
        text-decoration:none;         
    }         
    DIV {         
        WORD-WRAP: break-word; WORD-BREAK: break-all
    }         
    LI {         
        LIST-STYLE-TYPE: none; LIST-STYLE-IMAGE: none
    }         
    .nav {         
        MARGIN: 7px auto 0px; WIDTH: 968px; OVERFLOW: hidden
    }         
    .nav LI {         
        FLOAT: left; HEIGHT: 48px
    }         
    .nav_left {         
        WIDTH: 8px; BACKGROUND: url(img/s02.gif) no-repeat
    }         
    .nav_center {         
        WIDTH: 952px; BACKGROUND: url(img/s03.gif) repeat-x; FONT-SIZE: 16px
    }         
    .nav_right {         
        WIDTH: 8px; BACKGROUND: url(img/s04.gif) no-repeat
    }         
    .nav_li_li {         
        PADDING-RIGHT: 2px; BACKGROUND: url(img/s05.gif) no-repeat right top
    }         
    .nav A {         
        PADDING-BOTTOM: 0px; LINE-HEIGHT: 42px; PADDING-LEFT: 49px; PADDING-RIGHT: 49px; FLOAT: left; HEIGHT: 48px; COLOR: #fff; PADDING-TOP: 0px
    }         
    .nav .nav_on {         
        BACKGROUND: url(img/s06.jpg) no-repeat center top; TEXT-DECORATION: none
    }         
    .nav A:hover {         
        BACKGROUND: url(img/s06.jpg) no-repeat center top; TEXT-DECORATION: none
    }         
    .nav_li_li DIV {         
        Z-INDEX: 1000; BORDER-BOTTOM: #5970b2 1px solid; POSITION: absolute; BORDER-LEFT: #5970b2 1px solid; PADDING-BOTTOM: 5px; MARGIN-TOP: 42px; PADDING-LEFT: 5px; WIDTH: 190px; PADDING-RIGHT: 5px; ZOOM: 1; BACKGROUND: #ffffff 0px 0px; VISIBILITY: hidden; BORDER-TOP: #5970b2 1px solid; BORDER-RIGHT: #5970b2 1px solid; PADDING-TOP: 5px
    }         
    .nav_li_li DIV A {         
        POSITION: relative; TEXT-ALIGN: center; PADDING-BOTTOM: 5px; LINE-HEIGHT: 18px; MARGIN: 0px; PADDING-LEFT: 5px; WIDTH: 80px; PADDING-RIGHT: 5px; DISPLAY: block; WHITE-SPACE: nowrap; BACKGROUND: #ffffff 0px 0px; HEIGHT: 18px; COLOR: #2875de; FONT-SIZE: 12px; TEXT-DECORATION: none; PADDING-TOP: 5px
    }         
    .nav_li_li DIV A:hover {         
        BACKGROUND: #49a3ff; COLOR: #fff
    }

    调用js,记得修改路径

     代码如下 复制代码

    javascript" src="foot.js">

    dedecms标签实现的方法

     代码如下 复制代码

    js代码

     代码如下 复制代码

    var timeout=500;
    var closetimer=0;
    var ddmenuitem=0;
    function mopen(id)
    {
     mcancelclosetime();
     if(ddmenuitem)ddmenuitem.style.visibility='hidden';
     ddmenuitem=document.getElementById(id);
     ddmenuitem.style.visibility='visible';
    }
    function mclose()
    {
     if(ddmenuitem)ddmenuitem.style.visibility='hidden';
    }
    function mclosetime()
    {
     closetimer=window.setTimeout(mclose,timeout);
    }
    function mcancelclosetime()
    {
     if(closetimer)
    {
      window.clearTimeout(closetimer);
      closetimer=null;
     }
    }
    document.onclick=mclose;

    热门栏目