#1237900529:参数“each”使用“array”类型注册,但在视图助手“TYPO3 \ CMS \ Fluid \ ViewHelpers \ ForViewHelper”中的类型为“string”

时间:2015-08-02 23:54:15

标签: typo3 typoscript fluid typo3-6.2.x

我收到以下错误消息#1237900529:参数“each”使用“array”类型注册,但在视图助手“TYPO3 \ CMS \ Fluid \ ViewHelpers \ ForViewHelper”中的类型为“string” / strong>在尝试使用以下FLUIDTEMPLATE(FT)迭代迭代我的数据行时:

<h2>Sources</h2>
<f:for each="{content_source}" as="source">
    <p>{source.header}</p>
</f:for>

<h2>Contact</h2>
<f:for each="{content_contact}" as="contact">
    <p>{contact.header}</p>
</f:for>

我正在运行Typo3 6.2.14,并希望解析此HTML以匹配我自定义构建模板中的BootStrap架构。我对Typoscript&amp; amp; FT;然而,对于我来说,最好使用FT over TypoScript为html解析创建条件。如果我有以下TypoScript,我应该调整什么:

10 = FLUIDTEMPLATE
10{
    file= fileadmin/Templates/index.html
    layoutRootPath = fileadmin/Templates/layouts/
    partialRootPath = fileadmin/Templates/partials/
    variables {
        content_source < styles.content.get
        content_source.select.where = colPos=3
        content_contact < styles.content.get
        content_contact.select.where = colPos=4
    }
}

1 个答案:

答案 0 :(得分:2)

对于子孙后代,因为这个问题已经过时并且可能已经解决了:

当您以这种方式使用TypoScript中的变量时,您将获得呈现内容的字符串 - 不是内容记录数组或呈现内容HTML字符串数组。所以错误是正确的。

根据内容元素的类型,通常会有两条主要道路来设置您呈现内容的HTML输出的样式:

  • 更改TS包装等(如果您使用css_styled_content)或覆盖您要更改的模板(如果您使用fluid_styled_content)。
  • 覆盖要更改的模板,适用于使用FLUIDTEMPLATE TS对象或Extbase MVC的所有内容类型和插件。

最后,您可以在Fluid中使用第三方ViewHelper来获取原始内容记录并对其进行渲染 - 这将允许您将内容元素包装等内容应用为Fluid模板的一部分。请参阅https://fluidtypo3.org/viewhelpers/vhs/master/Content/GetViewHelper.htmlv:content.render对应方。