TYPO3菜单中的其他内容元素

时间:2014-09-09 11:25:39

标签: drop-down-menu typo3 typoscript

我在TypoScript中创建了一个菜单,其中在下拉部分我有子页面列表和新闻列表。菜单代码正在运行,但它会在每个子页面后显示新闻列表(子页面1和新闻列表,子页面2和新闻列表等)。我想要两个 独立元素(一个子页面列表和一个新闻列表),但我不知道如何实现这一点?

这是我的菜单代码:

lib.header_main-menu = COA
lib.header_main-menu {
    10 = HMENU
    10 {
        wrap = <ul class="nav navbar-nav">|</ul>
        entryLevel = 0

        1 = TMENU
        1 {
            noBlur = 1
            wrap = |
            expAll = 1

            NO = 1
            NO {
                ATagTitle.field = title
                wrapItemAndSub = <li>|</li>
                stdWrap.htmlSpecialChars = 1
            }
        }
        2 = TMENU
        2 {
            expAll = 1
            wrap = <div class="subnav-wrapper"><ul class="subnav">|</ul></div>

            NO = 1
            NO {
                wrapItemAndSub = <li>|</li>
                wrapItemAndSub.append = COA
                wrapItemAndSub.append {
                wrap = |
                10 = CONTENT
                10 < lib.header_menu_news
            }
        }
    } 
}

1 个答案:

答案 0 :(得分:0)

lib.header_main-menu = COA
lib.header_main-menu {
    wrap = <div>|</div>
    // this is section 10 of the COA
    10 = HMENU
    10 {
        wrap = <ul class="nav navbar-nav">|</ul>
        entryLevel = 0

        1 = TMENU
        1 {
            noBlur = 1
            wrap = |
            expAll = 1

            NO = 1
            NO {
                ATagTitle.field = title
                wrapItemAndSub = <li>|</li>
                stdWrap.htmlSpecialChars = 1
            }
        }
        2 = TMENU
        2 {
            expAll = 1
            wrap = <div class="subnav-wrapper"><ul class="subnav">|</ul></div>

            NO = 1
            NO {
                wrapItemAndSub = <li>|</li>
            }
        }
    } 
    // this is section 20 of the COA
    // btw the next line isn't necessary, you do that (define the object type) in lib.header_menu_news already
    // 10 (would be 20 now) = CONTENT
    20 < lib.header_menu_news
    20.wrap = <h3>News</h3>|
}

实际上,这与将它们分别放入模板相同

<div>###MENU###
<h3>News</h3>
###NEWSMENU###</div>
除非你在后端的某个地方使用lib.object,否则我会使用temp。相反 - 后者在构建页面对象后未设置,我的猜测是这可能对性能更好。

相关问题