我正在将 TypoScript CONTENT 对象与流体模板相结合。
在页面模板中:
<f:cObject typoscriptObjectPath="lib.myItem" />
在 TS 中:
lib.myItem = CONTENT
lib.myItem {
table = tt_content
select.where = colPos = 0
select.languageField = sys_language_uid
renderObj = FLUIDTEMPLATE
renderObj {
file = {$customContentTemplatePath}/Myfile.html
layoutRootPath = {$customContentLayoutPath}
partialRootPath = {$customContentPartialPath}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10.references.fieldName = image
}
}
}
在 Myfile.html 中:
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<div class="small-12 medium-6 large-4 columns">
<f:for each="{files}" as="file">
<v:media.image src="{file}" srcset="1200,900,600" srcsetDefault="600" alt="{file.alternative}" treatIdAsReference="1"/>
</f:for>
<div class="fp-ql-txt">
{data.header} >
</div>
</div>
但现在我意识到,因为模板是由 renderObj 为每个内容元素应用的,所以我无法访问流体的 for-each 迭代信息。所以,我不能这样做:
<f:for each="{data}" as="item" iteration="itemIterator">
{itemIterator.cycle}
</f:for>
找出我们在哪个渲染项目中......因为每个元素都是由renderObj
.
如何获取有关 renderObj 产品的迭代信息?仅在 TS 中使用旧的和可怕的计数器,如http://typo3-beispiel.net/index.php?id=9?