我对 typo3 有点陌生,但我使用网站包生成器创建了一个新的自定义元素,创建了一个新表并构建了 TCA 字段,它似乎进展顺利,我可以将内容保存在我的自定义元素中(标题、文本,图像)并在我的数据库中找到它但是当我尝试在前端呈现内容时我什么也得不到,甚至没有错误。
我的设置中有以下打字错误:
tt_content {
extention_key =< lib.contentElement
extention_key {
templateRootPaths.10 = EXT:extention_key/Resources/Private/Templates/ContentElements/
partialRootPaths.10 = EXT:extention_key/Resources/Private/Partials/ContentElements/
templateName = mytemplate
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tx_extention_key_items
pidInList.field = pid
selectFields = tx_extention_key_items.*
join = tt_content ON tx_extention_key_items.extention_items_content_relation = tt_content.uid
where = txextention_key_items.akkordeon_items_content_relation = tt_content.uid
orderBy = tt_content.sorting
as = items
}
}
20 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
20 {
references.fieldName = image
as = images
treatIdAsReference = 1
}
}
}
tx_extention_key_items.extention_items_content_relation = tt_content.uid 是我为要传递给模板的记录设置的条件,我已经检查了数据库并确认它确实在工作,我还确认 pid 是正确的。
对于我的模板,我有这个基本循环:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"></html>
<f:if condition="{items}">
<f:for each="{items}" as="item">
<div class="item">
<h2>{item.title}</h2>
<p>{item.description}</p>
<f:if condition="{item.image}">
<f:for each="{item.image}" as="image">
<f:image src="{image.uid}" alt="{image.title}" />
</f:for>
</f:if>
</div>
</f:for>
</f:if>
<f:debug title="My Debug Statement">{items}</f:debug>
问题是无法看到任何内容,使用浏览器工具检查显示空 html 标签,调试行返回我的项目数组,我可以看到它具有正确的 pid 并且关系字段与元素相同来自 tt_content 的 uid 应该意味着我的内容正在传递给模板,所以我不知道有什么问题,特别是当我没有收到任何错误消息时,尽管将 config.debug 设置为 1
任何有关如何解决此问题甚至在哪里寻找答案的提示都将不胜感激。