Typo3 - TMENU从Colpos获取内容

时间:2015-02-13 17:14:43

标签: typo3 typoscript

我有一个TMENU,在该菜单中,我将从菜单中的子页面获取内容。在每个页面上都是一个带内容的Col(colpos = 0)。是否可以将内容从那里获取到菜单?

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 个答案:

答案 0 :(得分:0)

css_styled_content中已经定义了这样一个菜单 TYPO3 / sysext / css_styled_content /静态/ 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>
            }
        }

如果您打算在项目中使用typoscript(当您使用fluid + vhs开发时几乎不再需要),那么css_styled_content始终是一个很好的参考点

答案 1 :(得分:0)

这是我的解决方案

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

   } 
 }
}

答案 2 :(得分:0)

今天我遇到类似的问题,我希望这个问题是最新的。 (使用带有fluid_styled_content的TYPO3 8.7.4。)

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

那样(当然我在这里简化了)我能够从特定列(在backend_layout中定义)中添加自定义填充内容,以便在导航面板中呈现。