1

我的输出是一个简单的 MenuProcessor,如下所示:

tt_content.content_element_overview_navigation =< lib.contentElement
tt_content.content_element_overview_navigation {
  templateName = OverviewNavigation
  dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
    10 {
      special = directory
      special.value.field = pages

      dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
        10 {
          references.fieldName = media
        }
      }
    }
  }
}

并且流体输出也可以正常工作:

lib.overviewContentNavigation = COA
lib.overviewContentNavigation {
    20 = COA
    20 =< tt_content.content_element_overview_navigation
}

流体输出:

<f:cObject typoscriptObjectPath="lib.overviewContentNavigation" />

但现在,我只需要 treeLevel 5 中的输出。 我的测试:

[tree.level == 5]
  lib.overviewContentNavigation = COA
  lib.overviewContentNavigation {
    20 = COA
    20 =< tt_content.content_element_overview_navigation
  }
[end]

如果 tree.level/typoscriptObjectPath 为空,那么我会在前端收到错误消息。如何检查空输出?

不要工作:

<f:if condition="{f:cObject(typoscriptObjectPath:'lib.overviewContentNavigation')}">
    <f:cObject typoscriptObjectPath="lib.overviewContentNavigation" />
</f:if>
4

1 回答 1

2

您每次都需要对象路径,因此只有在满足条件时才添加内容。我会试试这个:

lib.overviewContentNavigation = COA
lib.overviewContentNavigation.20 = COA

[tree.level == 5]
lib.overviewContentNavigation {
  20 =< tt_content.content_element_overview_navigation
}
[end]
于 2022-02-21T13:28:11.040 回答