菜单中的 TYPO3 DataProcessing 提取物 tt_content

TYPO3 DataProcessing extract tt_content in a menu

我在 colPos=0

中搜索带有 DataProcessing 的 TYPO3 TypoScript 解决方案来构建菜单和 tt_content 的一部分
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
        }
    }
}

但它仅适用于活动页面并且所有页面都获得相同的内容。

您需要告诉您的 DatabaseQueryProcessor 它在哪个页面上。 使用当前查询,您可以获得所有页面的所有内容元素。

尝试:

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

这会获取当前页面的 uid 并将其添加到您的内容查询的 where 条件中。

试试这个修改后的版本,因为不需要在查询设置中使用换行:

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

这里是最终代码,现在可以使用了!

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