[TYPO3-mvc] FLUID: extended loop features

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jan 7 13:20:19 CET 2010


Hi Masi,

> Actually there are two things of interest: a "switch" where a value is to be checked if it is the
> "case" that it has a certain value. And a "ifelse" like construct that allows various conditions to
> be checked without the need of nesting "if" blocks.

hehe, I also thought about a ifelse situation in bed yesterday :) But I 
think the current approach is sufficient here for now, although the 
resulting nesting level will be harder to read.

But maybe something similar to a switch/case construct might work for 
more complex ifelse situations:

<f:switch.condition>
   <f:case condition="{object.foobar} > 2 && {object.foobar} < 8">
	do something
   </f:case>
   <f:case condition="{object.foobar} > 2">
	do something else
   </f:case>
   <f:default>
	fallback to something
   </f:default>
</f:switch.condition>

The viewHelper would aggregate one child after another and return the 
first matching one. If non matches it's returning a "default" child if 
available.

And for a regular switch/case construct:

<f:switch value="{object.foobar}">
    <f:case value="2"> do Something </f:case>
    <f:case value="4"> do Something </f:case>
    <f:default> return a default value </f:default>
</f:switch>


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list