将内容从TypoScript传递到TYPO3 7.6中的流体模板 [英] Pass content from TypoScript to fluid template in TYPO3 7.6
问题描述
我想通过TypoScript读取内容并通过自定义的Fluid模板进行呈现.没有css_styled_content或fluid_styled_content.
I would like to read content via TypoScript and render it through a custom Fluid template. Without css_styled_content or fluid_styled_content.
temp.test = CONTENT
temp.test {
table = tt_content
select.languageField = 1
select.selectFields = bodytext,image,header,header_link
select.where = colPos = 1
renderObj = FLUIDTEMPLATE
renderObj {
file = path/to/Teaser.html
}
}
例如,这适用于字符串
<f:debug>{data.header}</f:debug>
但不是
<f:debug>{data.image}</f:debug>
仅返回图像数.
现在,在经典的TypoScript RenderObj(也许是COA)中,您应该添加类似的内容
Now, in a classic TypoScript RenderObj (maybe a COA), you would have added something like
10 = FILES
10 {
required = 1
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid // file:current:uid
file.width=654
file.height = 327c
//stdWrap.typolink.parameter.data = file:current:link
altText.data = file:current:description // file:current:title // file:current:alternative
}
}
如今,我们要在Fluid模板中执行此操作.但是如何解析FAL图像以将其传递到流体模板?
While nowadays, we want to do that in the Fluid template. But how to resolve the FAL image to pass it to the fluid template?
推荐答案
您应该能够使用TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
数据处理器,该处理器将为您获取文件数据,以便您可以使用模板中的{files}
进行访问.
You should be able to use the TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
data processor that will fetch the file data for you so you can access it with {files}
in your template.
renderObj = FLUIDTEMPLATE
renderObj {
file = path/to/Teaser.html
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10.references.fieldName = image
}
}
这篇关于将内容从TypoScript传递到TYPO3 7.6中的流体模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!