0
votes

I would like to build a full with dropdown menu based on page content defined into a folder.

The idea is to have:

MENU (folder) - menu 1 (page) - menu 2 (page)

My goal is to get the following output:

  • menu 1 content in menu 1 page
  • menu 2 content in menu 2 page

There is only one content bloc in the pages.

No problem to get the li with menu 1 / 2 but I cannotfind the way to get and wrap the page content.

My code looks like

menu.nav = HMENU
menu.nav {
  special = directory
  special.value = 214
  entryLevel = 1
  1 = TMENU
  1.wrap = <ul>|</ul>
  1.expAll = 1
  1.NO = 1
  1.NO.wrapItemAndSub.cObject = TEXT
  1.NO.wrapItemAndSub.cObject.value = <li>|</ul></li>
  1.NO.after.cObject = COA
  1.NO.after.cObject {
    10 = TEXT
    10.value = <div class="dropdown">

    20 = CONTENT
    20 {
      table = tt_content
      select {

.... 

but I cannot figure out what is required here to get the content of the pages.

Does someone can help me with this issue?

Thanks in advance. Regards Joël

3

3 Answers

0
votes

I'll try a solution here, hoping that I'm not simplifying too much your code,at least you could take it as a starting point:

menu.nav = HMENU
menu.nav {
    special = directory
    special.value = 214    
    1 = TMENU
    1.wrap = <ul>|</ul>
    1.NO {

        wrapItemAndSub = <li>|</li>
        after.cObject = CONTENT
        after.cObject {
            table = tt_content
            select {
                pidInList.field = uid
                where =   {#colPos} = 0   
            }
            renderObj = < tt_content
            wrap = <div class="dropdown">|</div>  
        }
    }
} 

I took this one as starting point.

0
votes

I had a similar problem sometime ago, came upwith this code to make a menu containing database information.

It is not an answer, but it is a similar piece of code. Hopefully it gives you an idea.

It generates a list of links to pages which have "no_search" = 0 or another condition. There is also a database join made to get the pagepath or url of pages in the site.

Think you can do the same thing with your page content, output it as html.

lib.sitemap = CONTENT
lib.sitemap {
  table = pages
  select {
    orderBy = pages.sorting
    selectFields = pages.uid, pages.title, tx_realurl_pathcache.pagepath
    join = tx_realurl_pathcache ON tx_realurl_pathcache.page_id=pages.uid
    pidInList = 44
    recursive = 7
    where = (no_search="0") or (nav_hide=1 and no_search=0)
    groupBy = tx_realurl_pathcache.page_id
  }
  renderObj = COA
  renderObj.wrap = <li>|</li>
  renderObj.10 = TEXT
  renderObj.10 {
    field = pagepath
    wrap = <a href="|">
  }
  renderObj.20 = TEXT
  renderObj.20.field = title
  renderObj.30 = TEXT
  renderObj.30.value = </a>
}
lib.sitemap.wrap = <ul> | </ul>
0
votes

You have to do this

lib.navbar2 = COA
lib.navbar2.wrap = <nav>|</nav>
lib.navbar2 {
20 = HMENU
20.wrap = <ul>|</ul>
20 {
    #entryLevel = 0
    #excludeUidList = 11,12
    1 = TMENU
    1 {
        wrap = |
        expAll = 1

        NO = 1
        NO.allWrap >
        NO.wrapItemAndSub = <li>|</li>
        NO.after.cObject = COA
        NO.after.cObject{
            stdWrap.wrap = <div class="megamenu-wrapper">|</div>
            20 = CONTENT
            20 {
                table = tt_content
                select {
                    pidInList.field = uid
                    orderBy = sorting
                    where = colPos=4 
                    languageField=sys_language_uid
                }
            }
            20.wrap = |
        }

        ACT = 1
        ACT < .NO
        ACT.wrapItemAndSub = <li class="active">|</li>

        CUR = 1
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active">|</li>
    }
}
}