Attention
TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.
section¶
A ViewHelper to declare sections in templates for later use with e.g. the RenderViewHelper.
= Examples =
<code title="Rendering sections"> <f:section name="someSection">This is a section. {foo}</f:section> <f:render section="someSection" arguments="{foo: someVariable}" /> </code> <output> the content of the section "someSection". The content of the variable {someVariable} will be available in the partial as {foo} </output>
<code title="Rendering recursive sections"> <f:section name="mySection">
- <ul>
- <f:for each="{myMenu}" as="menuItem">
- <li>
{menuItem.text} <f:if condition="{menuItem.subItems}">
<f:render section="mySection" arguments="{myMenu: menuItem.subItems}" />
</f:if>
</li>
</f:for>
</ul>
</f:section> <f:render section="mySection" arguments="{myMenu: menu}" /> </code> <output> <ul>
- <li>menu1
- <ul>
<li>menu1a</li> <li>menu1b</li>
</ul>
</li>
[...] (depending on the value of {menu}) </output>