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

Fernando Arconada falcifer2001 at yahoo.es
Sat Jun 12 13:26:48 CEST 2010


Should be useful to have a regexp operator in the if viewhelper?
I think that it is a very common operation



El Sat, 12 Jun 2010 11:42:29 +0200, Franz Koch escribió:

> 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.





More information about the TYPO3-project-typo3v4mvc mailing list