Index: openacs-4/packages/acs-templating/www/doc/tagref/if.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/tagref/if.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/doc/tagref/if.html 24 Feb 2004 11:16:32 -0000 1.3 +++ openacs-4/packages/acs-templating/www/doc/tagref/if.html 7 Aug 2017 23:48:03 -0000 1.4 @@ -12,7 +12,7 @@
The if tag is used to output a template section only when +
The if tag is used to output a template section only when certain conditions are met.
- x0 [- The operatornot
]op
+ x0 [not
]op
x1 x2 ...
op
determines the number operands
+ The operator op
determines the number operands
(x0, ... xn-1).
The following operators are available:
gt
+ x0 gt
x1
ge
+ x0 ge
x1
lt
+ x0 lt
x1
le
+ x0 le
x1
eq
+ x0 eq
x1
ne
+ x0 ne
x1
in
+ x0 in
x1 x2
x3 ...
between
+ x0 between
x1 x2
nil
+ x0 nil
defined
+ x0 defined
odd
+ x0 odd
even
+ x0 even
true
+ x0 true
false
+ x0 false
Any of these operators can be prefixed with
- not
to invert the outcome.
+ not
to invert the outcome.
Any legal variables that may be referenced in the template may -also be used in if statements. Words not surrounded with -the commerical at sign (@) are interpreted literally.
+also be used in if statements. Words not surrounded with +the commercial at sign (@) are interpreted literally.Phrases with spaces in them must be enclosed in quotes to be grouped correctly:
<if @datasource.variable@ eq "blue sky"> - <td bgcolor=#0000ff> + <td bgcolor="#0000ff"> </if>-
The elseif tag may be used following an if block +
The elseif tag may be used following an if block to specify an alternate conditional template section.
<if @datasource.variable@ eq "blue"> - <td bgcolor=#0000ff> + <td bgcolor="#0000ff"> </if> <elseif @datasource.variable@ eq "red"> <td bgcolor=red> </elseif> <else> - <td bgcolor=#ffffff> + <td bgcolor="#ffffff"> </else>-
The else tag may be used following an if block +
The else tag may be used following an if block to specify an alternate template section when a condition is not true:
<if @datasource.variable@ eq "blue"> - <td bgcolor=#0000ff> + <td bgcolor="#0000ff"> </if> <else> - <td bgcolor=#ffffff> + <td bgcolor="#ffffff"> </else>
Compound expressions can be created by combining terms with the -and and or keywords, as illustrated above. Any +and and or keywords, as illustrated above. Any number of statements may be connected in this fashion. There is no way to group statements to change the order of evaluation.
-When a variable is tested using the nil operator, it will +
When a variable is tested using the nil operator, it will return true if the variable is undefined or if the value of the variable is an empty string.