2

我想通过 TypoScript 阅读内容并通过自定义 Fluid 模板进行渲染。没有 css_styled_content 或 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)中,您应该添加类似

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
  }
}

而现在,我们想在流体模板中做到这一点。但是如何解析 FAL 图像以将其传递给流体模板?

4

2 回答 2

3

您应该能够使用TYPO3\CMS\Frontend\DataProcessing\FilesProcessor将为您获取文件数据的数据处理器,以便您可以{files}在模板中访问它。

renderObj = FLUIDTEMPLATE
renderObj {
  file = path/to/Teaser.html
  dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    10.references.fieldName = image
  }
}
于 2016-03-18T08:46:47.770 回答
1

主要问题是所有图像信息都存储在名为“sys_file_reference”的不同表中。在这里选择“tt_content.image”对您没有帮助。恕我直言,有两种方法可以解决此问题。

1)创建自己的viewhelper。此 VH 可用于查询图像,因为它在此处完成。

2) 创建一个小的 TypoScript 库并将其用作流体模板中的 f:cObject。这在此处进行了描述。

我并不是说我的解决方案是最好的。但这是我所知道的唯一一个。期待看到更好的解决方案;)

于 2016-03-18T07:13:35.330 回答