Occasionally, the text to be included in a document is dependent upon some data. The if tag is provided to support the conditional insertion of text based on DTML variables or expressions. As described in "DTML Tag Syntax", the dtml-if tag has four forms:
The dtml-if tag works in a straightforward manner. The variable or expression given in the dtml-if tag is evaluated. If the variable or expression value is true12, then the text following the dtml-if tag is inserted. If the variable or expression value is false, then for each dtml-elif tag given, the variable or expression given in the dtml-elif tag is evaluated. If an dtml-elif variable or expression value is true, the text following the dtml-elif tag is inserted and none of the following dtml-elif variables or expressions are evaluated. If there are no dtml-elif tags or if all of the dtml-elif tag variable or expression values are false, then the text following the dtml-else tag is inserted. If no dtml-else tag was supplied, then no text is inserted.
The dtml-if and dtml-elif tags support only the standard name and expr attributes. The dtml-else tag accepts no attributes.
In addition to the dtml-if tag, the dtml- unless tag is provided with its associated closing tag, /dtml-unless, to insert text if a condition is false. Like the dtml-if tag, the dtml- unless tag accepts the standard name and expr attributes:
You did not provide a name.