Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Created September 12, 2014 10:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminrau/c4629625728e4c9bbdfc to your computer and use it in GitHub Desktop.
Save benjaminrau/c4629625728e4c9bbdfc to your computer and use it in GitHub Desktop.
Switch news detail view template based on parent category
<f:section name="Main">
<f:if condition="{newsItem}">
<v:switch value="{newsItem.categories -> v:iterator.extract(key: 'parentcategory') -> v:iterator.extract(key: 'uid') -> v:iterator.first() -> v:or(alternative: 0)}">
<v:case case="{v:variable.typoscript(path: 'plugin.tx_mmstemplates.settings.campaignsRootCategoryUid')}" break="TRUE">
<f:render partial="News/Detail/Campaign" section="Main" arguments="{_all}" />
</v:case>
<v:case case="default">
<f:render partial="News/Detail/Default" section="Main" arguments="{_all}" />
</v:case>
</v:switch>
</f:if>
</f:section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment