简体   繁体   English

TYPO3 从打字稿和流体模板渲染事件

[英]TYPO3 render Event from typoscript and Fluid template

In TYPO3 10.4.8 I have the following page tree:在 TYPO3 10.4.8 我有以下页面树:

root

1level: Events 1级:事件

2level: Event A, Event B, Event C, ... and so... 2级:事件A,事件B,事件C,......等等......

What I want to do in page Events is to render all subpages title, using FLUIDTEMPLATE.我想在页面事件中做的是使用 FLUIDTEMPLATE 呈现所有子页面标题。

So in the template of page Events I wrote所以在我写的页面事件模板中

lib.EventContent = COA
lib.EventContent {
    10 = COA
    10{
        table = pages
        select {
            orderBy = sorting
            pidInList = this
        }
    }
}

and in the layout file并在布局文件中

<f:for each="lib.EventContent" as="event" >
    <p>event: {event.title}</p>
</f:for>

This doesn't work.这行不通。 Typo give me this error:错字给我这个错误:

The argument "each" was registered with type "array", but is of type "string" in view helper "TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper".参数“each”注册为“array”类型,但在视图助手“TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper”中属于“string”类型。

In addition, I also tried to change COA with CONTENT, in all possible combination (COA-CONTENT / CONTENT-COA / CONTENT-CONTENT) What's wrong?另外,我还尝试用 CONTENT 更改 COA,在所有可能的组合中(COA-CONTENT / CONTENT-COA / CONTENT-CONTENT)有什么问题? is something that I cannot do?是我不能做的事吗?

Thanks all谢谢大家

The TypoScript should look something like this: TypoScript 应如下所示:

lib.EventContent = CONTENT
lib.EventContent {
    table = pages
    select {
      orderBy = sorting
      pidInList = this
    }
}

But there is a much easier solution.但是有一个更简单的解决方案。 TYPO3 already brings a content element "Subpages" which renders a menu of all subpages of a selected page: TYPO3 已经带来了一个内容元素“子页面”,它呈现所选页面的所有子页面的菜单:

在此处输入图像描述

This is done via Fluid Styled Content and TypoScript.这是通过 Fluid Styled Content 和 TypoScript 完成的。 Please check this file for details: typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuSubpages.typoscript有关详细信息,请检查此文件: typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuSubpages.typoscript

A solution for you might look like this (untested):您的解决方案可能如下所示(未经测试):

lib.EventContent < tt_content.menu_subpages
lib.EventContent {
  dataProcessing {
    10 {
      special >
    }
  }
}

It's also a good idea to have a look in all the TypoScript files in the Fluid Styled Content extension to get more inspiration.查看 Fluid Styled Content 扩展中的所有 TypoScript 文件以获得更多灵感也是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM