简体   繁体   中英

Additional content element in TYPO3 menu

I made a menu in TypoScript in which on drop down section I have list of subpages and list of news. The code of menu is working but it render the list of news after every subpage (subpage1 and list of news, subpage 2 and list of news... etc). I would like to have two independent element (one list of subpages and one list of news), but i don't know how to achieve that?

here is my menu code:

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
            }
        }
    } 
}
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>|
}

actually, this comes to the same as putting them into the template separately

<div>###MENU###
<h3>News</h3>
###NEWSMENU###</div>

btw unless you use the lib.object in the Backend somewhere, I would use temp. instead - the latter are unset after building the page object, and my guess would be that this might be better for performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM