[TYPO3-mvc] <f:elseif condition="">
Laurent Foulloy
yolf.typo3 at orange.fr
Tue Aug 10 12:10:56 CEST 2010
Hi Franz,
I like the switch approach which is more flexible (the second syntax is
clear for me. Will it be a future feature in the core ? Is your
viewhelper available somewhere, I will appreciate to have it ?
Best regards
Laurent
Franz Koch a écrit :
>
> to implement such I logic, I created a switch/case viewHelper pair,
> which allows some more flexibility too.
>
> // traditional usage
> <x:switch value="{foo.bar}">
> <x:case value="{matchValue"}>gimme</x:case>
> <x:case value="{whatever}">someting</x:case>
> <x:case default="true">fallback</x:case>
> </x:switch>
>
> // mixed usecase with condition support in cases
> <x:switch return="firstMatch/allMatches">
> <x:case condition="{matchValue} = 1">gimme</x:case>
> <x:case condition="{f:count(subject:whatever)}">someting</x:case>
> <x:case default="true">fallback</x:case>
> </x:switch>
>
> switch/case might not be the best naming for the last usecase, but
> didn't find a better one back then.
More information about the TYPO3-project-typo3v4mvc
mailing list