Sebastian
Sebastian

Reputation: 930

TYPO3 DataProcessing extract tt_content in a menu

I search for a TYPO3 TypoScript solution with a DataProcessing to build the menu and a part of tt_content in the colPos=0

110 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
110 {
    special = directory
    special.value = 41
    levels = 9
    includeSpacer = 0
    as = placesnavigation
    titleField = nav_title // title

    dataProcessing {
        20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
        20 {
            table = tt_content
            orderBy = sorting
            where = colPos = 0
            as = placesInfoContent
        }
    }
}

But it works only from the active page and all pages get the same content.

Upvotes: 0

Views: 895

Answers (3)

Sebastian
Sebastian

Reputation: 930

here the final code, which now works!

110 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
110 {
    special = directory
    special.value = 41
    levels = 4
    includeSpacer = 0
    as = placesnavigation
    titleField = nav_title // title

    dataProcessing {
        20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
        20 {
            table = tt_content
            pidInList.field = uid
            orderBy = sorting
            where = colPos = 0
            as = placesInfoContent
        }
    }
}

Upvotes: 0

Jo Hasenau
Jo Hasenau

Reputation: 2684

Try this modified version, since there is no need to use the wrap within the query settings:

110 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
110 {
  special = directory
  special.value = 41
  levels = 9
  includeSpacer = 0
  as = placesnavigation
  titleField = nav_title // title
  expandAll = 1
  dataProcessing {
    20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
    20 {
      table = tt_content
      pidInList.field = uid
      orderBy = sorting
      as = placesInfoContent
    }
  }
}

Upvotes: 1

Thomas Löffler
Thomas Löffler

Reputation: 6144

you need to tell your DatabaseQueryProcessor on which page it is. With the current query you get all content elements of all pages.

Try:

110 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
110 {
                special = directory
                special.value = 41
                levels = 9
                includeSpacer = 0
                as = placesnavigation
                titleField = nav_title // title
                
                expandAll = 1

                dataProcessing {
                    20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
                    20 {
                        table = tt_content
                        orderBy = sorting
                        where {
                          data = field:uid
                          wrap = colPos = 0 AND pid = |
                        }
                        as = placesInfoContent
                    }
                }
            }

This takes the current page uid and adds it to the where condition of your content query.

Upvotes: 2

Related Questions