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}
* (var after ENDLOOP is optional) * the 'var' comes from your PHP code * IF/ELSE/ELSEIF control structures can be nested in other IF or LOOP control structures * LOOP/ENDLOOP control structures can be nested in other IF or LOOP control structures Control Structure - INCLUDE While not a true Control Structure, the INCLUDE directive loads external data, in place, in your template. Templates can be included in other templates by using the INCLUDE statement. All functionality available to the main template is also available to the sub template (variable substitution, etc.). This permit the use of subtemplating. The syntax is: * file to include is in the template directory (default '_skins/') * similar to the method $page->addtpl() ... difference is that 'addtpl' stores the data in a variable that then gets assigned ('$page->assign()') within the main template