我將TypoScript CONTENT對象與流體模板組合在一起。結合TypoScript和流體:迭代?
在頁面模板:
<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,我沒有訪問fluid的每個關於迭代的信息。所以,我不能做到這一點:
<f:for each="{data}" as="item" iteration="itemIterator">
{itemIterator.cycle}
</f:for>
,找出其中所呈現的項目,我們是...,因爲每個單元由renderObj
單獨呈現的。
如何獲取有關renderObj產品的迭代信息?只有在TS和http://typo3-beispiel.net/index.php?id=9那些古老而可怕的櫃檯?
哇,謝謝...當我有一分鐘時,我會嘗試一下 – Urs
我想你不只是寫那個專案 - 你是否也有這個用例呢?你認爲這是一個有效的場景嗎? – Urs
當然是。我將在我的一個項目中使用那個非常DataProcessor。 – Daniel