Go to the first, previous, next, last section, table of contents.


IF - Conditionally Emit a Template Block

Conditional block. Its arguments are evaluated (see section EXPR - Evaluate and emit an Expression) and if the result is non-zero or a string with one or more bytes, then the condition is true and the text from that point until a matched ELIF, ELSE or ENDIF is emitted. ELIF introduces a conditional alternative if the IF clause evaluated FALSE and ELSE introduces an unconditional alternative.

[+IF <full-expression> +]
emit things that are for the true condition[+

ELIF <full-expression-2> +]
emit things that are true maybe[+

ELSE "This may be a comment" +]
emit this if all but else fails[+

ENDIF "This may *also* be a comment" +]

<full-expression> may be any expression described in the EXPR expression function, including the use of apply-codes and value-names. If the expression yields an empty string, it is interpreted as false.


Go to the first, previous, next, last section, table of contents.