Dreamweaver lets you develop code blocks that incorporate control statements that execute conditionally. The Server Behavior Builder uses if
, elseif
, and else
statements, and may also contain server behavior parameters. This enables you to insert alternate text blocks based on the values of OR relationships among server behavior parameters. The if
, elseif
, and else
statements appear as shown below. Note that square brackets ([ ]) denote optional code, and the asterisk (*) denotes zero or more instances:
<@ if (expression1
) @>conditional text1
[<@ elseif (expression2
) @>conditional text2
]* [<@ else @>conditional text3
] <@ endif @>
Condition expressions can be any JavaScript expression that can be evaluated using the JavaScript eval()
function, and may include a server behavior parameter marked by @@'s. (The @@'s are necessary to distinguish the parameter from JavaScript variables and keywords.)
You can nest any number of conditionals or a loop directive (see Repeating code blocks) within a conditional directive. For example, you can specify that if an expression is true to execute a loop.
NOTE |
|
New lines after each "@>" are ignored. |
This section covers the following topics: