结合TypoScript和Fluid:迭代? [英] Combining TypoScript and Fluid: Iterations?

查看:142
本文介绍了结合TypoScript和Fluid:迭代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将TypoScript CONTENT对象与流体模板结合在一起.

I'm combining a TypoScript CONTENT Object with a fluid template.

在页面模板中:

<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中:

In 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的有关迭代的for-each信息.所以,我不能这样做:

But now I realized that because the template is applied by the renderObj for each content element, I don't have access to fluid's for-each information about iteration. So, I can't do this:

  <f:for each="{data}" as="item" iteration="itemIterator">
  {itemIterator.cycle}
  </f:for>

找出我们在哪个渲染项目中...,因为每个元素都是由renderObj单独渲染的.

to find out in which of the rendered items we are ... because each element is rendered individually by renderObj.

如何获取有关renderObj产品的迭代信息?仅在具有旧的和可怕的计数器的TS中,如 http://typo3-beispiel.net/index.php?id = 9 吗?

How can I get the iteration information about the renderObj's products? Only in TS with the old and terrifying counters as in http://typo3-beispiel.net/index.php?id=9 ?

推荐答案

您应该检出TYPO3 Core随附的DatabaseQueryProcessor.

You should check out the DatabaseQueryProcessor shipped with the TYPO3 Core.

https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html#dataprocessing

请注意,数据处理仅在FLUIDTEMPLATE cObject内部进行.

Please note that data processing only work inside the FLUIDTEMPLATE cObject.

您还可以在文档中找到一个有效的示例.

You also find a working example inside the documentation.

这篇关于结合TypoScript和Fluid:迭代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆