Dreamweaver CS4 | ![]() |
Dreamweaver CS4 Resources |
Multiple If condition in template codeYou can define template expressions for if and multiple-if conditions. This example demonstrates defining a parameter named "Dept", setting an initial value, and defining a multiple-if condition which determines which logo to display. The following is an example of the code you might enter in the head section of the template: <!-- TemplateParam name="Dept" type="number" value="1" --> The following condition statement checks the value assigned to the Dept parameter. When the condition is true or matches, the appropriate image is displayed. <!-- TemplateBeginMultipleIf --> <!-- checks value of Dept and shows appropriate image--> <!-- TemplateBeginIfClause cond="Dept == 1" --> <img src=".../sales.gif"> <!-- TemplateEndIfClause --> <!-- TemplateBeginIfClause cond="Dept == 2" --> <img src=".../support.gif"> <!-- TemplateEndIfClause--> <!-- TemplateBeginIfClause cond="Dept == 3" --> <img src=".../hr.gif"> <!-- TemplateEndIfClause --> <!-- TemplateBeginIfClause cond="Dept != 3" --> <img src=".../spacer.gif"> <!-- TemplateEndIfClause --> <!-- TemplateEndMultipleIf --> When you create a template-based document, the template parameters are automatically passed to it. The template user determines which image to display. |