Skip to content

Instantly share code, notes, and snippets.

@Bjoelin
Last active May 6, 2024 11:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bjoelin/0c803af3f3b8f420e91f4adb07fe01a5 to your computer and use it in GitHub Desktop.
Save Bjoelin/0c803af3f3b8f420e91f4adb07fe01a5 to your computer and use it in GitHub Desktop.
How to check if a page is within the rootline of another page in TYPO3 Fluid
<f:comment>Regular syntax</f:comment>
<v:condition.iterator.contains needle="<the page id>" haystack="{v:page.rootline() -> v:iterator.extract(key: 'uid')}">
<f:then></f:then>
<f:else></f:else>
</v:condition.iterator.contains>
<f:comment>Inline syntax</f:comment>
{v:condition.iterator.contains(
needle: item.uid,
haystack: '{v:page.rootline() -> v:iterator.extract(key: \'uid\')}',
then: 'foo',
else: 'bar'
)}
Credits to Sven Wappler
https://www.wapplersystems.de/blog/typo3-pidinrootline-fluid-style/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment