QuickSkin Control Structures (Used within templates)
Control Structure - IF
The if ... endif construct facilitates the conditional presentation of template fragments.
The syntax can be one of the following:
var is not empty!
Your name is John Doe!
Your name is not John Doe!
A variable can be used as right part of the IF clause using the folloging syntax:
Your name match with {variablename}
Your name doesn't match with {top.variablename}
* (var after ENDIF is optional)
* the 'var' comes from your PHP code
* IF/ELSE/ELSEIF control structures can be nested in other IF or LOOP control structures
Control Structure - ELSE
The else construct extends an if construct to display a template fragment in case the
expression in the if statement evaluates to FALSE.
ADMIN Login
You are in guest mode!
* (var after ENDIF is optional)
* the 'var' comes from your PHP code
* IF/ELSE/ELSEIF control structures can be nested in other IF or LOOP control structures
Control Structure - ELSEIF
The elseif construct is a combination of an else and if construct.
Admin Staff Login
Support Staff Login
Standard Login
You don't even have a usergroup!
* (var after ENDIF is optional)
* the 'var' comes from your PHP code
* IF/ELSE/ELSEIF control structures can be nested in other IF or LOOP control structures
Control Structure - LOOP ... ENDLOOP
The loop ... endloop construct facilitates a way to iterate through numeric arrays.
Each element of the numeric array is expected to be an associative array and is used
to parse the template fragment that is embedded between the
and
tags like it was a small template itself.
Each associative array is expanded by the following two additional elements:
ROWCNT : The actual position of this element within the parent array. (0,1,2,3,...n)
ROWBIT : The least significant bit of ROWCNT. (0,1,0,1,0,1,...)
loop ... endloop blocks can easily be nested and parsed recursivly.
Example, assuming this code precedes in your PHP:
$users = array(
array( 'NAME' => 'John Doe', 'GROUP' => 'ADMIN' ),
array( 'NAME' => 'Jack Doe', 'GROUP' => 'SUPPORT' ),
array( 'NAME' => 'James Doe', 'GROUP' => 'GUEST' ),
array( 'NAME' => 'Jane Doe', 'GROUP' => 'GUEST' ),
);
$page->assign( 'users', $users );
The template, then, would contain:
No. | Username | Usergroup |
---|---|---|
{ROWCNT} | {NAME} | {GROUP} |