Bug #29004

if viewhelper does not evaluate conditions correctly

Added by Manuel Stofer over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Must have
Category:
Core
Target version:
-
Start date:
2011-08-16
Due date:
% Done:

0%

Estimated time:
Has patch:
No

Description

Actually the if viewhelper just typecasts the parameter 'condition' to boolean
which is not what you expect when you read the comments in the header.

In the header of IfViewhelper.php you can find examples like:
<f:if condition="{rank} % 2">
Will be shown if rank % 2 != 0.
</f:if>

But when you do something like this:

<f:if condition="4 % 2">
4 % 2 != 0
</f:if>

<f:if condition="4 5">
4 5
</f:if>

Fluid outputs:

4 % 2 != 0
4 == 5


Related issues

Is duplicate of TYPO3.Fluid - Feature #26665: Fluid: Implement String comparisonResolved2010-03-10

Actions
#1

Updated by Manuel Stofer over 10 years ago

and forge does not escape correct :)

was supposed to be

<f:if condition="4 equals 5">
4 equals 5
</f:if>

( equals = '==' )

#2

Updated by Bastian Waidelich over 10 years ago

  • Category set to Core
  • Status changed from New to Closed
  • Assignee set to Bastian Waidelich

Hi,

the actual issue is, that you can't compare two literals at the moment (see #26665).
<f:if condition="{someNumber} % 2">
should work as expected.

Also available in: Atom PDF