<dpIf>
D E F I N I T I O N:
Conditional tests allow you to make comparisons within your templates. For example, you can calculate how many characters are in a story, and provide a special layout for each circumstance.
Simple Condition Syntax
<dpIf (comparison statement)>
action
</dpIf>
Complete Condition Syntax
<dpIf (comparison statement)>
action
<dpElseIf (comparison statement)>
action
<dpElse>
action
</dpIf>
C O M P A R I S O N O P E R A T O R S:
| = | equal |
| != | not equal |
| in | is in set |
| not | not in set |
| gt | greater than |
| lt | less than |
E X A M P L E S:
The following can be read as "If the section for this story is music, then display the message You're in the music section":
<dpIf <dpSection>="music">
You're in the music section
</dpIf>
The following can be read as "If the section for this story is music, then display the message You're in the music section, else (otherwise) display You're not in the music section":
<dpIf <dpSection>="music">
You're in the music section
<dpElse>
You're not in the music section
</dpIf>
The following can be read as "If the section for this story is music, then display the message 'You're in the music section', else if the section for this story is film, then display the message 'You're in the film section', else (otherwise) display 'You're not in the music or film section' ."
<dpIf <dpSection>="music">
You're in the music section
<dpElseIf <dpSection>="film">
You're in the film section
<dpElse>
You're not in the music or film section
</dpIf>
The following can be read as "If you're not in the film section, display the message Go to the film section":
<dpIf <dpSection> != "film">
Go to the film section.
</dpIf>
| Home: Support: Reference Guide: Flow Control: <dpIf> | Questions? Comments? Please write support@desert.net. |