We can use the if tag to define complex condition judgments, such as: & lt; ifcondition & quot; ($ nameeq1) OR ($ namegt100) & quot; & gt; value1 & lt; elseifcondition & quot; $ nameeq2 & quot;/& gt; value2 & lt; else...
We can use the if tag to define complex condition judgments, for example:
- Value1
- Value2
- Value3
-
In the condition attribute, you can support eq and other judgment expressions. comparison labels are the same as above, but they do not support the use of symbols such as ">" and "<", because template parsing is obfuscated, so the following usage is incorrect:
- Value1
- Value2
-
Must be changed:
- Value1
- Value2
-
In addition, we can use php code in the condition attribute, for example:
- ThinkPHP
- Other Framework
-
The condition attribute supports dot syntax and object syntax. for example, it automatically determines whether the user variable is an array or an object:
- ThinkPHP
- Other Framework
-
Or you know that the user variable is an object.
- ThinkPHP
- Other Framework
-
Because the condition attribute of the if tag basically uses the php syntax, it is more concise to use the judgment tag and Switch tag. in principle, if you can use the switch or comparison label, try not to use the if label, because the switch and comparison label can use the variable regulator and system variable. if there are some special requirements, IF the label still cannot meet the requirements, you can use the native php code or PHP label to directly write the code.
Eq equals (=)
Neq is not equal (! =)
Gt greater than (>)
Egt greater than or equal to (> =)
Lt is less than (<)
Elt less than or equal to (<=)
Heq constant equals (=)
Nheq is not always equal (! =)
Condition
Note:In the condition attribute value, the variable requires the $ symbol, which is different from other labels.
Tip:In judging the output series labels, use more concise comparison labels and switch labels as much as possible.
If the judgment labels provided by ThinkPHP still cannot meet special requirements, you can directly use native PHP code or PHP labels to meet the requirements.