This function returns true if ALL of the present conditions are met (they are AND'ed). If a single condition is false, the value returned is false.
The returned value may still be negated by the ".negate"-property.
Property: | Data type: | Description: | Default: |
|---|---|---|---|
isTrue | str / stdWrap | If the content is "true".... (not empty string and not zero) | |
isFalse | str / stdWrap | If the content is "false"... (empty or zero) | |
isPositive | int / stdWrap + calc | returns false if content is not positive | |
isGreaterThan | value / stdWrap | returns false if content is not greater than ".value" | |
isLessThan | value / stdWrap | returns false if content is not less than ".value" | |
equals | value / stdWrap | returns false if content does not equal ".value" | |
isInList | value / stdWrap | returns false if content is not in the comma-separated list ".value". The list in ".value" may not have spaces between elements!! | |
value | value / stdWrap | "value" (the comparison value mentioned above) | |
negate | boolean | This negates the result just before it exits. So if anything above returns true the overall returns ends up returning false!! | |
directReturn | boolean | If this property exists the true/false of this value is returned. Could be used to set true/false by TypoScript constant |
[tsref:->if]
the "if"-function is a very odd way of returning true or false! Beware!
"if" is normally used to decide whether to render an object or return a value (see the cObjects and stdWrap)
Here is how it works:
The function returns true or false. Whether it returns true or false depends on the properties of this function. Say if you set "isTrue = 1" then result is true. If you set "isTrue.field = header" the function returns true if the field "header" in $cObj->data is set!
If you want to compare values, you must load a base-value in the ".value"-property. Example:
.value = 10
.isGreaterThan = 11
This would return true because the value of ".isGreaterThan" is greater than 10, which is the base-value.
More complex is this:
.value = 10
.isGreaterThan = 11
.isTrue.field = header
.negate = 1
There are two conditions - isGreaterThan and isTrue. If they are both true, the total is true (AND) BUT (!) the result if the function in total is false because the ".negate"-flag inverts the result!