0

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
            }
        }
    } 
}
3
  • Can't you just make two menus, if they have to be separated?
    – Urs
    Sep 10, 2014 at 12:26
  • They has to be in one div element
    – Adrian
    Sep 10, 2014 at 12:42
  • That's no reason, you can wrap them at will. I'll post it below, but maybe I don't understand your question
    – Urs
    Sep 10, 2014 at 17:46

1 Answer 1

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

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.

1
  • Thanks Urs for your help and tips (I will use temp object) :)
    – Adrian
    Sep 11, 2014 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.