Sebastian
Sebastian

Reputation: 930

TYPO3 TreeLevel and FLUID - empty

my output is a simple MenuProcessor like this:

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

and the Fluid Output work also fine:

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

Fluid Output:

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

But now, i need the output only in the treeLevel 5. My Test:

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

If the tree.level / typoscriptObjectPath is empty, then I get an error in the frontend. How can i check the empty output?

Dont work:

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

Upvotes: 1

Views: 300

Answers (1)

Thomas L&#246;ffler
Thomas L&#246;ffler

Reputation: 6144

You need the object path every time, so only add the content when condition is met. I would give this a try:

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

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

Upvotes: 2

Related Questions