下拉菜单不工作Typo3

时间:2015-11-27 09:02:10

标签: typo3 typoscript dropdown

我的下拉菜单无法正常工作。 Here  你可以找到我正在处理的菜单。

当我按下' Produkte'应该打开一个包含2个子菜单​​点的下拉菜单。 如果我得到这个下拉列表,并且这些菜单点再次有子菜单,则应该有另一个下拉列表。这可能吗 ?如果是,那么,我对TypoScript来说是一个新手......

编辑:好吧,我刚看到<a href="#">..</a>,我怎么能链接这个亲戚,所以如果我添加一个新的子菜单点,它会自动显示在那里? 也许使用data-target="dropdown"

lib.field_topmenu = HMENU 
lib.field_topmenu {
  1 = TMENU
  1 {
wrap = <ul class="nav navbar-nav">|</ul>
expAll = 1
NO = 1
NO {
        allWrap = <li>|</li>
        ATagTitle.field = title 
}
ACT = 1
ACT {
        wrapItemAndSub = <li class="active">|</li>
        ATagTitle.field = title 
}
IFSUB = 1
IFSUB {
            before = <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-target="dropdown">
            after =  <b class="caret"></b></a>
            doNotLinkIt = 1
            wrapItemAndSub = <li class="dropdown">|</li>
            ATagTitle.field = title 
            ATagParams = class="dropdown-toggle" data-toggle="dropdown"
            ATagBeforeWrap = 1
}
ACTIFSUB = 1
ACTIFSUB {
            before = <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            after =  <b class="caret"></b></a>
        #   doNotLinkIt = 1
            wrapItemAndSub = <li class="dropdown active">|</li>
            ATagTitle.field = title 
            ATagBeforeWrap = 1
 }
}
2 = TMENU
     2 {
    expAll = 1
    wrap = <ul class="dropdown-menu">|</ul>
ACT = 1
ACT {
        wrapItemAndSub = <li class="active">|</li>
        ATagTitle.field = title
}
ACTIFSUB = 1
ACTIFSUB {
            wrapItemAndSub = |
            before = <li class="divider"></li><li class="nav-header">
            after = </li>
        #   doNotLinkIt = 1
            ATagTitle.field = title 
}
NO {
        allWrap = <li>|</li>
        ATagTitle.field = title 
}
IFSUB = 1
IFSUB {
            before = <li class="divider"></li><li class="nav-header">
            after = </li>
            doNotLinkIt = 1
            ATagTitle.field = title 
}
SPC = 1
SPC {
        allWrap = <li class="divider"></li><li class="nav-header">|</li>
}
  }
 3 = TMENU
3 {
NO {
        allWrap = <li>|</li>
        ATagTitle.field = title 
}
ACT = 1
ACT {
        wrapItemAndSub = <li class="active">|</li>
        ATagTitle.field = title 
   }
 }

2 个答案:

答案 0 :(得分:2)

解决了问题。

lib.field_topmenu = HMENU
lib.field_topmenu {
    entryLevel = 0
    1 = TMENU
    1 {
        expAll = 1
        wrap = <ul class="nav navbar-nav"> | </ul>
        noBlur = 1
        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
            stdWrap.htmlSpecialChars = 1
            ATagTitle.field = title
        }
        ACT <.NO
        ACT {
            wrapItemAndSub = <li class="active">|</li>
        }
        IFSUB <.NO
        IFSUB {
            allWrap = <!!==:>|
            wrapItemAndSub = <li class="dropdown">|</li>
            ATagBeforeWrap = 1
            linkWrap = |&nbsp;<b class="caret"></b>
            ATagParams = class="dropdown-toggle" data-toggle="dropdown"
        }
        ACTIFSUB < .IFSUB
        ACTIFSUB {
            allWrap = <!!==:>|
        }
    }
    2 = TMENU
    2 {
        wrap = <ul class="dropdown-menu" role="menu" aria-labelledby="dLable">|</ul>
        expAll = 1

        NO = 1
        NO {
            allWrap = <li>|</li>
            stdWrap.htmlSpecialChars = 1
        }

        ACT < .NO
        ACT.ATagParams = class="active"
        ACT.allWrap = <li class="active">|</li>

        IFSUB < .NO
        IFSUB.wrapItemAndSub = <li class="dropdown">|</li>
        IFSUB.ATagParams = class="dropdown-toggle" data-toggle="dropdown"
        IFSUB.linkWrap = |&nbsp;<b class="caret"></b>
        IFSUB.ATagBeforeWrap = 1

        ACTIFSUB < .IFSUB
        ACTIFSUB {
            allWrap = <!!==:>|
    }

    3 = TMENU
    3 { 
            wrap = <ul class="dropdown-menu" role="menu" aria-labelledby="dLable">|</ul>
            expAll = 1
            NO = 1
            NO.allWrap = <li>|</li>
            NO.stdWrap.htmlSpecialChars = 1
            ACT < .NO
            ACT.ATagParams = class="active"
            ACT.allWrap = <li class="active">|</li>
    }
}
}
lib.title_banner = IMAGE
lib.title_banner {
                file {
                    import.data = levelmedia:-1, slide
                    treatIdAsReference = 1
                    import.listNum = 0
                }
}

答案 1 :(得分:0)

如果您希望整个子菜单中包含wrapItemAndSub标记,则必须使用allWrap代替<li>

通常,您应首先创建一个可用的HTML标记,然后使用TypoScript生成该标记。