|
<div xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers" |
|
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"> |
|
|
|
<!-- v:or can be used for long chains of conditions where the first |
|
not-empty value gets used --> |
|
|
|
<!-- If {person} for example can have three different email addresses' |
|
but you only wish to display one of them: --> |
|
|
|
Email: {person.workEmail -> v:or(alternative: person.secretaryEmail) -> v:or(alternative: person.homeEmail)} |
|
|
|
<!-- Which displays one of the three email addresses with priority |
|
to the workplace email, secondary priority to a secretary's |
|
email and if neither is defined, person's home email --> |
|
|
|
<!-- Can also be used as a chain after any other condition to use |
|
the "alternative" value if neither condition case outputs content --> |
|
|
|
{f:if(condition: person.workEmail, then: person.workEmail, else: person.secretaryEmail) -> v:or(alternative: person.homeEmail)} |
|
|
|
<!-- Which is exactly the same as the above example with two v:or tags |
|
but as you can see, takes less space and is easier to read --> |
|
|
|
<!-- Can also be used to deliver default images when no image exists: --> |
|
|
|
<f:image src="{myObject.imageFile -> v:or(alternative: settings.defaultImageFile)}" alt="" /> |
|
|
|
<!-- All in all, a more compact alternative to multiple f:if tags which |
|
is ideally used as inline syntax in chains. --> |
|
|
|
</div> |