简体   繁体   中英

If Typo3 submenu is in diffrent code section

I need a drop-down menu that is a first level and second level menu. If you click example first menu item then this sub-menu is opening. First level must open in header section and second level must open in content section. Example is below. I can do to this when everything is one header section, but I don't know how to make it if sub-menu must be in another section.

Header section begin

Logo Menu link 1 Menu link 2 Menu link 3

Header section end

Content section begin

If cliked any menulink in above, then this item submenu opening here

...

Section end

<header id="section-header" class="section-header">
  <div id="zone-header-wrapper" class="zone-header-wrapper">  
    <div class="menu-block-wrapper>
      <ul class="menu">
         <li class="first leaf menu-mlid">..<li>
      <ul>
     </div>
    </div>
</header>
<section id="section-content" class="section-content">
 <div id="zone-content-wrapper" class="zone-content-wrapper">  
   <div class="menu-block-wrapper>
     <ul class="submenu">
       <li class="first leaf menu-mlid">..<li>
     </ul>
  </div>
</div>

So far I have first level menu code below.

lib.mainNavi = HMENU
lib.mainNavi.entryLevel = 1
lib.mainNavi.1 = TMENU
lib.mainNavi.1 {
  wrap = <ul class="menu">|</ul>
  expAll = 0
  NO.allWrap = <li class="first leaf menu-mlid">|</li>|*|<li class="expanded leaf menu-mlid">|<li>|*|<li class="has-separator leaf menu-mlid">|</li>
  NO.ATagParams =  |*|  |*| class="has-separator"
 }

Thank you for you answers!

You can render your submenu with typosript like you did with your main menu.

lib.submenu = HMENU
  lib.submenu {
    special = directory
    special.value.data = leveluid:1
    entryLevel = 1
    1 = TMENU
    1 {
      ...
    }
}

From TSREF : A HMENU of type special = directory lets you create a menu listing the subpages of one or more parent pages. The parent pages are defined in the property ".value".

So this will render you the subpages of the page you navigated to with your main menu, regardless where in its subpages you are. You can configure this to behave different of course.

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