![](/img/trans.png)
[英]TYPO3 Gridelements w/DataProcessing and FLUID no content
[英]TYPO3 DataProcessing: How to control the order of the output?
我有一个包含来自掩码自定义内容元素的内容 uid 的列表。 编辑器可以从列表中选择一些内容元素。 现在我想要来自这些内容元素 uid 的完整数据。 所以我尝试了 DatabaseQueryProcessor。
我第一次尝试使用 DataProcessing。
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = tx_mask_sectionmenu_contentitems
as = items
}
}
这几乎有效,但流体输出中的顺序与原始列表的顺序不匹配。 如何强制流体输出的顺序与原始列表中的顺序相同?
或者我必须先检查 SplitProcessor 吗? 到目前为止,这个 SplitProcessor 可以工作,但我不知道在下一个 DatabaseQueryProcessor 中要指定什么?
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\SplitProcessor
10 {
if.isTrue.field = tx_mask_sectionmenu_contentitems
delimiter = ,
fieldName = tx_mask_sectionmenu_contentitems
removeEmptyEntries = 1
filterIntegers = 0
filterUnique = 1
as = items
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
???
as = contentItem
}
}
}
}
排序字段不是我想要的。 我想要与编辑器选择的相同的排序。
我该如何解决这个问题?
我测试了uidInList.field = tx_mask_sectionmenu_contentitems
但它没有帮助按逗号分隔的 uid 列表的顺序对记录进行排序。
嵌套方法根本不起作用。 我查看了代码,发现只有DatabaseQueryProcessor
、 LanguageMenuProcessor
和MenuProcessor
能够使用另一个 MenuProcessor 处理内容。
# All properties from .select can be used directly
# + stdWrap
colPos = 1
pidInList = 13,14
并检查选择属性https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html给你
uidInList =
pidInList =
recursive =
orderBy =
groupBy =
max =
begin =
where =
languageField =
includeRecordsWithoutDefaultTranslation =
selectFields =
join =
leftjoin =
rightjoin =
因此,不要在此处使用嵌套的dataProcessing
,您可能希望跳过orderBy
并转而使用uidInList
。
uidInList.field = tx_mask_sectionmenu_contentitems
如果您想继续使用嵌套方法,您仍然应该使用 uidInList,但略有不同
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\SplitProcessor
10 {
if.isTrue.field = tx_mask_sectionmenu_contentitems
delimiter = ,
fieldName = tx_mask_sectionmenu_contentitems
removeEmptyEntries = 1
filterIntegers = 0
filterUnique = 1
as = items
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = current
as = contentItem
}
}
}
}
要获取“current”的实际字段名称,您可能需要将<f:debug>{items}</f:debug>
放入 Fluid 模板中。 或许这是data = current
相反,如果实际行为current
是在这种情况下可用。
据我所知,SplitProcessor 不像其他 DataProcessor 那样支持任何进一步的 dataProcessing(至少如果没有注意到其他选项列表中的任何 dataProcessing): https ://docs.typo3.org/m/ Typo3/reference-typoscript/main/en-us/ContentObjects/Fluidtemplate/DataProcessing/SplitProcessor.html
这是一种解决方法,也适用于 TYPO3 11:
https://forge.typo3.org/issues/86151
简而言之:
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = tx_mask_sectionmenu_contentitems
selectFields.dataWrap = *,FIND_IN_SET(uid,'{field:pages}') AS foobar_sort
orderBy = foobar_sort
as = contentItem
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.