我在colPos=0 中搜索具有DataProcessing的TYPO3 TypoScript解决方案来构建菜单和tt_content的一部分
110 = TYPO3CMSFrontendDataProcessingMenuProcessor
110 {
special = directory
special.value = 41
levels = 9
includeSpacer = 0
as = placesnavigation
titleField = nav_title // title
dataProcessing {
20 = TYPO3CMSFrontendDataProcessingDatabaseQueryProcessor
20 {
table = tt_content
orderBy = sorting
where = colPos = 0
as = placesInfoContent
}
}
}
但它只能在活动页面上工作,并且所有页面都获得相同的内容。
您需要告诉DatabaseQueryProcessor
它在哪个页面上。使用当前查询,您可以获得所有页面的所有内容元素。
尝试:
110 = TYPO3CMSFrontendDataProcessingMenuProcessor
110 {
special = directory
special.value = 41
levels = 9
includeSpacer = 0
as = placesnavigation
titleField = nav_title // title
expandAll = 1
dataProcessing {
20 = TYPO3CMSFrontendDataProcessingDatabaseQueryProcessor
20 {
table = tt_content
orderBy = sorting
where {
data = field:uid
wrap = colPos = 0 AND pid = |
}
as = placesInfoContent
}
}
}
这将获取当前页面uid,并将其添加到内容查询的where条件中。
试试这个修改后的版本,因为不需要在查询设置中使用换行符:
110 = TYPO3CMSFrontendDataProcessingMenuProcessor
110 {
special = directory
special.value = 41
levels = 9
includeSpacer = 0
as = placesnavigation
titleField = nav_title // title
expandAll = 1
dataProcessing {
20 = TYPO3CMSFrontendDataProcessingDatabaseQueryProcessor
20 {
table = tt_content
pidInList.field = uid
orderBy = sorting
as = placesInfoContent
}
}
}
这里是最后的代码,现在可以工作了!
110 = TYPO3CMSFrontendDataProcessingMenuProcessor
110 {
special = directory
special.value = 41
levels = 4
includeSpacer = 0
as = placesnavigation
titleField = nav_title // title
dataProcessing {
20 = TYPO3CMSFrontendDataProcessingDatabaseQueryProcessor
20 {
table = tt_content
pidInList.field = uid
orderBy = sorting
where = colPos = 0
as = placesInfoContent
}
}
}