Template expressions are statements you use to compute or evaluate a value.
You can use an expression to store a value and display it in a document. For example, an expression can be as simple as the value of a parameter, such as
@@(Param)@@, or complex enough to compute values which alternate the background color in a table row, such as
@@((_index & 1) ? red : blue)@@.
You can also define expressions for if and multiple-if conditions (for an example, see The Multiple If condition in template code). When an expression is used in a conditional statement, Dreamweaver evaluates it as
false. If the condition is true, the optional region appears in the template-based document; if it is false, it doesnt appear.
You can define expressions in Code view or in the Optional Region dialog box when you insert an optional region. For more information about writing template expressions, see The template expression language.
In Code view, there are two ways to define template expressions: use the
<!-- TemplateExpr expr="your expresson"--> comment or
@@(your expression)@@. When you insert the expression in the template code, an expression marker appears in Design view. When you apply the template, Dreamweaver evaluates the expression and displays the value in the template-based document.
This section covers the following topics:
- The template expression language
- The Multiple If condition in template code