|
Conditions |
Top Previous Next |
|
Conditions are used to either show or hide a block of text depending on the variable value.In a template file conditions are represented in the following way:
{$variable{block of text}}
If $variable is true (or not empty), 'block of text' is shown. If you want to show it if the $variable is false (or empty), use the following syntax:
{!$variable{block of text}}
Be sure to have two brackets in the end, otherwise your page will not work! Inside the brackets you may put any HTML text, variables and includes. If you need to use a conditional block inside of another condition block, use the following syntax:
{{$variable{ sometext {$another_variable{text shown if both variables are true}} moretext }}}
Notice the 2 opening brackets before the first $variable and the 3 closing brackets at the end! You can combine this syntax with the ! modifier making the block appear if a variable is false (or empty). Example :.
{{!$variable{ this text will be shown if variable is false {$another_variable{and this text will appear if another_variable is true}} }}}
In an unlikely event that you need to use more than 2 conditions inside ofeach other, try combining conditions with includes, i.e. putting one of the conditions inside of an include.
|