[TYPO3-mvc] fluid if string condition

"Christian Müller (Kitsunet)" christian at kitsunet.de
Tue Jan 4 20:15:35 CET 2011


On 04.01.2011 18:50, Dawid Pacholczyk wrote:
> Ofc I had to find solution 5 sec after sending this question :)
>
> <f:if condition="{myvar}">
> Displayed if myvar is neither an empty string nor "0".
> </f:if>
>
>
> Best regards,
> Dawid "Fixus" Pacholczyk
>
> On 04.01.2011 18:48, Dawid Pacholczyk wrote:
>> Hello List !
>>
>> In my template I would like to check if variable of type string has a
>> value diffrent than empty string.
>>
>> Something like that
>>
>> if($variable != '')
>> echo $variable;
>>
>> I`ve tried
>>
>> <f:if condition="{variable} != ''">
>> <f:then>
>> {variable}
>> </f:then>
>> </f:if>
>>
>> But it didn`t work
>>
>> Is it possible in fluid ?
>>
>> Best regards,
>> Dawid Pacholczyk
>

Yep, that should work, although strings in general are not yet supported 
by the if view helper due to parsing problems. To have a workaround set 
integer/bool values to a variable in your controller or view if you need 
a more complex string comparison.


More information about the TYPO3-project-typo3v4mvc mailing list