Attention
TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
alias¶
Declares new variables which are aliases of other variables. Takes a "map"-Parameter which is an associative array which defines the shorthand mapping.
The variables are only declared inside the <f:alias>...</f:alias>-tag. After the closing tag, all declared variables are removed again.
= Examples =
<code title="Single alias"> <f:alias map="{x: 'foo'}">{x}</f:alias> </code> <output> foo </output>
<code title="Multiple mappings"> <f:alias map="{x: foo.bar.baz, y: foo.bar.baz.name}">
{x.name} or {y}
</f:alias> </code> <output> [name] or [name] depending on {foo.bar.baz} </output>
Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively you might want to fine-tune your "view model" (the data you assign to the view).