[TYPO3-mvc] fluid <f:if > with a regular expression

Franz Koch typo3.RemoveForMessage at elements-net.de
Sat Jun 12 11:42:29 CEST 2010


Hey,

> I'm trying something like
> <f:if condition="preg_match('/Thumbnail/',{image.name})">
> <f:then>
> 	{image.file}
> </f:then>
> </f:if>
>
> but it always return true
>
> any idea?

You can't use preg_match in the if-viewHelper. FLUID is not calling 
"eval" on the conditions, but uses a parser with limited functionality 
to resolve boolean expressions. So you might need to create you own 
viewHelper for that.

Btw. - if you don't use/need a <f:else> condition, you don't need to use 
<f:then> then.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list