TYPO3 Fluid Tipp 5: Dynamischer Zugriff auf Variablen

<!-- Recursive variable resolving -->
<f:variable name="array" value="{0: 'foo', 1: 'bar'}" />
<f:variable name="index" value="1" />
Variable "index" contains the array position we need.
Dynamic array index #{index}: {array.{index}} <!-- bar -->
 
<f:variable name="typeOne" value="This is type 1" />
<f:variable name="typeTwo" value="This is type 2" />
<f:variable name="selectedType" value="Two" />
Variable "selectedType" is a string that's part of a variable name.
Dynamic named variable: {type{selectedType}} <!-- This is type 2 -->

Fluid unterstützt den dynamischen Einsatz von Variablen als Teile von Variablennamen. Hier ein kleines Beispiel dazu:

Quelle: https://twitter.com/NamelessCoder/status/937995733873184768

Bei werkraum Digitalmanufaktur wird dieses Feature sehr geschätzt!

Hat Dir der Artikel gefallen?