Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading