[TYPO3-mvc] How to use If-ViewHelper with other than true/false

Joerg Schoppet joerg at schoppet.de
Mon Jun 8 22:51:19 CEST 2009


Bastian Waidelich schrieb:
> Sebastian KurfŸürst wrote:
> 
> Hi there,
> 
>> With this expression language
> 
> Ah, I always get quite excited when you mention it *g
> See http://forge.typo3.org/repositories/revision/517/2575 for more 
> information.
> 
> One side note though:
> You should really try to minimize the usage of complex conditions in 
> your templates. They should be used _only for display logic_ like
> <ul>
>     <f:for each="{users}" as="user" key="index">
>         <li <f:if condition="{index} % 
> 2">class="even"</f:if>">{user.firstName} {user.lastName}</li>
>     </f:for>
> </ul>
> 
> That's one reason (besides the complex implementation) why 
> string-comparisons are not supported by Fluid.
> Something like the following should not be in your view/template logic:
> 
> <f:if condition="{customer.status} == 'gold'}">....
> 
> If you think, there is a scenario where you really need to compare 
> strings, please post it here so we can discuss it!
> 
> Bastian

These are exactly the two scenarios I have in mind:
1. table-row formatting
2. simple switching depending on the value of a radio-button


Joerg


More information about the TYPO3-project-typo3v4mvc mailing list