peni4142
peni4142

Reputation: 545

typo3 TypoScript creating a menu for subpages from any page of any level

I try to get the children to the actual page.

This is my best try:

      10 {
          dataProcessing {
              100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
              100 {
                levels = 1
                entryLevel = page:level
                includeSpacer = 1
                includeNotInMenu = 0
                as = children
                expandAll = 0
              }
          }

      }

I tried to get the menu level of the current page, but I couldn't find something in the documentation that is helping. Do you have an idea?

My goal is to create a menu for all subpages at the next level.

Thank you for your time :-)

Adjusted solution:

      10 {
          dataProcessing {
          100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
          100 {
              as = children
              special = directory
              special.value.field = pages
              dataProcessing {
                  10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
                  10 {
                      references.fieldName = media
                  }
              }
          }

props @Thomas Löffler Danke ;-)

Upvotes: 1

Views: 288

Answers (1)

Thomas Löffler
Thomas Löffler

Reputation: 6144

there is a content element in TYPO3 named "menu of subpages" which is integrated in TypoScript as well.

What I got from the core (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuSubpages.typoscript):

tt_content.menu_subpages =< lib.contentElement
tt_content.menu_subpages {
    templateName = MenuSubpages
    dataProcessing {
        10 = menu
        10 {
            special = directory
            special.value.field = pages
            dataProcessing {
                10 = files
                10 {
                    references.fieldName = media
                }
            }
        }
    }
}

If you don't want to display any images you can remove the files part.

Beware that the example is taken from latest version. There you can replace the dataprocessor class names.

Upvotes: 1

Related Questions