0
votes

i have an TMENU, in that Menu I would have the Content from the Subpages in the Menu. On every Page is an Col (colpos=0) with Content. Is it possible to get the Content from there to the Menu?

lib.mainmenu = HMENU 
lib.mainmenu {
        1 = TMENU
        1 {
            wrap = <ul id="mainmenu">|</ul>
            expAll = 1
            NO {
                wrapItemAndSub = <li>|</li>
                ATagParams =  class="drop"
            }

        }
        2 = TMENU
        2 {
            wrap = <div class="dropdown_produkte"><div class="nav-tabs"><ul>|</ul></div></div>
            NO {            
            wrapItemAndSub = <li>|</li>

          }
          2.40 = CONTENT
          2.40 {
            table = tt_content
            select.pidInList.field = pid
            select.where = colPos=0

            select.languageField=sys_language_uid

            wrap = <div class="teaser">|</div>
          }
        }
}
3

3 Answers

0
votes

There is already such a menu defined in css_styled_content typo3/sysext/css_styled_content/static/setup.txt

# "Menu of subpages to these pages + sections - liststyle"
        7 < .1
        7 {
            stdWrap {
                outerWrap = <ul class="csc-menu csc-menu-7">|</ul>
            }
            1.expAll = 1
            2 < .1
            2 {
                sectionIndex = 1
                sectionIndex.type = header
                wrap = <ul>|</ul>
                NO.wrapItemAndSub = <li class="csc-section">|</li>
            }
        }

If you are going to use typoscript in your project (wich you hardly need anymore when you develope with fluid + vhs) than css_styled_content is always a good reference point

0
votes

Here is my Solution

lib.mainmenu = HMENU 
lib.mainmenu {
   1 = TMENU
   1 {
     wrap = <ul id="mainmenu">|</ul>
     expAll = 1
     NO {
       wrapItemAndSub = <li>|</div></li>
       ATagParams =  class="drop"
     }
     submenuObjSuffixes = a || b || c || d || e
   }
 2a < .1
 2a {
   wrap = <div class="dropdown_produkte">|</div>
   stdWrap.cObject = COA
   stdWrap.cObject {

     20 = HMENU
     20 {
       special = directory
       special.value.data = field:pid

       1 = TMENU
       1 {
         expAll = 1
         wrap = <div class="nav-tabs"><ul>|</ul>

         NO {
           wrapItemAndSub = <li>|</li>
           #stdWrap.dataWrap = <h2>|</h2>
           #linkWrap = | |*|  &nbsp;/&nbsp;
           ATagParams = class=submenu
         }
         ACT < .NO
         ACT = 1
         ACT {
           ATagParams = class=submenuActive
         }
         RO < .ACT 
       }
     }



     40 = CONTENT
     40 {
       table = pages
       select {
        pidInList.field = pid
        orderBy = sorting
       }

       renderObj = COA_INT
       renderObj {
             10 = TEXT
             #10.field = title
             10.wrap = |
             20 = LOAD_REGISTER
             20 {
               meinRegister.cObject = TEXT
               meinRegister.cObject.field = uid
             }

           50 = COA
           50 {
             ###########
             20 = CONTENT
             20 {
             table = tt_content
             select {
               pidInList.data = register:meinRegister
               where = colPos=0
               }
             }
             ###########
           }
         }
     }

   } 
 }
}
0
votes

As I faced a similar issue today, I wanted this question to be up to date. (Using TYPO3 8.7.4 with fluid_styled_content.)

lib.mainmenu = HMENU 
lib.mainmenu {
    1 = TMENU
    1 {
        wrap = <ul id="mainmenu" class="level1">|</ul>
        expAll = 1
        NO {
            wrapItemAndSub = <li>|</li>
            ATagParams = class="drop"
        }
    }
    2 < .1
    2 {
        wrap = <div class="wrapper">|</div>
        stdWrap.innerWrap = <ul class="level2">|</ul>

        stdWrap.append = CONTENT
        stdWrap.append {
            table = tt_content
            select {
                pidInList.field = pid
                where = colPos = 5 and deleted = 0 and hidden = 0
            }
            stdWrap.wrap = <div class="content">|</div>
        }
    }
    3 < .2
    3 {
        NO.wrapItemAndSub = <li>|</li>
        wrap = <ul class="level3">|</ul>
        stdWrap.append >
    }
}

That way (of course I simplified it here) I was able to add custom populated content from a specific column (defined in a backend_layout) to be rendered inside a navigation panel.