通过dataProcessing / DatabaseQueryProcessor获取sys_category项目以显示在菜单中

时间:2018-07-30 08:29:01

标签: typo3 typoscript data-processing typo3-9.x

菜单起作用。但是猫总是空的。 data.categories显示给定页面分配多少个类别的计数。但是cats数组仅显示:cats => array(empty)。我的TYPOSCRIPT怎么了?

        40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        40 {
            expandAll = 1
            levels = 7
            as = menuMain
            dataProcessing {
                100 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
                100 {
                    if.isTrue.field = categories
                    table = sys_category
                    select {
                        pidInList = root,-1
                        selectFields = sys_category.*
                        join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
                        where.data = field:_ORIG_uid // field:uid
                        where.intval = 1
                        where.wrap = sys_category_record_mm.uid_foreign=|
                        orderBy = sys_category_record_mm.sorting_foreign
                        languageField = 0 # disable translation handling of sys_category
                    }
                    as = cats
                }
            }
        }

3 个答案:

答案 0 :(得分:0)

尝试添加recursive = 99以查找所有页面。 我有一个适用的类别示例,请参见:https://github.com/spoonerWeb/just_news/blob/master/Configuration/TypoScript/RenderingDefinitions/news_list.ts

答案 1 :(得分:0)

DatabaseQueryProcessor没有“选择”参数。 因此,您应该将其删除并将所有子参数上移一个水平。

答案 2 :(得分:0)

50 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
50 {
  if.isTrue.field = categories
  table = sys_category
  pidInList = root,-1
  selectFields = sys_category.*
  recursive = 99
  as = categories
}

这对我有用。