OpenWGA 7.9 - WebTML reference

WebTML tags » [All tags]

<tml:[All tags] if ="itemexpression">

Purpose:

If the condition in the if Item-Expression is false the tag is not rendered.

May be combined with if_equals. In this case the item-expression is compared with this if_equal value to evaluate as true or false.

Description:

Attribute "if" receives a "boolean item expression" which tests WebTML items and calculates a boolean result or compare the result against the if_equals value. The expression must return true for the tag to be rendered, otherwise it is cancelled.

The "unless" expression has priority over the "if" expression. When both are present and evaluate true then the tag is cancelled.

Boolean item expression

A simple expression syntax to use WebTML items for evaluating a boolean result. Consisting of:

  • Item term: Just anything that is valid in this.item() as item name, like names of content items, WebTML variables, Renderer/Controller property expressions
  • Boolean Operators: & being "and", | being "or", between those item terms. There may be only one type of boolean operator on one expression, so "a | b", "a & b & c" is valid, "a | b & c" is invalid.
  • Brackets to form sub expressions, where again a single boolean operator can be used, differing from the one on the main expression: "(a | b) & c"
  • Exclamation mark operators to negate either item expressions or sub expressions: "!a", "!(a & b)"
  • Equals operator = being "equals". Must be the last operator in the expressen. Not valid in combination with if_equals.

If not used together with if_equals every item term is evaluated for its boolean value by the rules of TMLContext.isTrue(). Then the boolean values are combined in the ways determined by operators to form a result value.

If combined with if_equals or if equals operator (=) is used each item term is compared against the equals-expression and the results are combined in the ways determined by operators to form a final result value. So a&b=1 means a and b must be 1,  a|b=1 means a or b must be 1.

Value(s):

Item expression

Examples:

<tml:input name="product" if="products_available"/>

<tml:case if="$mc.value=100">...</tml:case>

<tml:case if="$mc-value" if_equals="100">...</tml:case>