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

Bastian Waidelich bastian at typo3.org
Mon Jun 8 13:20:03 CEST 2009


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


More information about the TYPO3-project-typo3v4mvc mailing list