|
When the result of a PAD tag is false the part after {construct 'else'} is used.
{page 'constructs/else_1'}
<hr>The {construct 'else'} construct is a general feature of every PAD tag, it applies to all PAD tags.<br><br>
{example 'constructs/else_4'}
<hr>When the result of a PAD tag is an empty array the part after {construct 'else'} is used.
{page 'constructs/else_2'}
<hr>The {construct 'else'} context can also be given with the 'else' option at the tag itself.
{page 'constructs/else_3'}
|
When the result of a PAD tag is false the part after @else@ is used.
| HTML |
RESULT |
{if 2 > 1} true @else@ false {/if}
| true | {if 1 > 2} true @else@ false {/if}
| false |
The @else@ construct is a general feature of every PAD tag, it applies to all PAD tags.
PHP constructs/else_4.php
|
HTML constructs/else_4.pad
|
Result
|
<?php
$myVar = FALSE;
?> |
{myVar} true @else@ false {/myVar}
|
false
|
When the result of a PAD tag is an empty array the part after @else@ is used.
| HTML |
RESULT |
{data 'myArray1'} [1,2,3] {/data}
| | {myArray1} Occurence {$myArray1} <br> @else@ No occurences {/myArray1}
| Occurence 1
Occurence 2
Occurence 3
| {data 'myArray2'} [] {/data}
| | {myArray2} Occurence {$myArray2} <br> @else@ Nothing to see here {/myArray2}
| Nothing to see here |
The @else@ context can also be given with the 'else' option at the tag itself.
| HTML |
RESULT |
{data 'myArray'} [] {/data}
| | {content 'nothing'} Nothing to see here {/content}
| | {myArray else='nothing'} Occurence {$myArray} <br> {/myArray}
| Nothing to see here | {if 1 > 2, else='nothing'} true {/if}
| Nothing to see here |
|