- <?php
- /*include the class*/
- include_once('../class.XiTemplate.php');
-
- /*instantiate the class and pass the path to your html template file*/
- $xitpl = new XiTemplate('templates/rparse.tpl');
-
- /*assign a value to a template variable.*\
- /*In this example {NAME} will be replaced with "XiTemplate"*/
- $xitpl->assign('NAME', 'XiTemplate');
-
- /*this variable exists in subBlock1*/
- $xitpl->assign('SUB1', 'sub block 1');
-
- /*this variable exists in subBlock2*/
- $xitpl->assign('SUB2', 'sub block 2');
-
- /*this variable exists in subBlock3*/
- $xitpl->assign('SUB3', 'sub block 3');
-
- /*only parsing subBlock3*/
- $xitpl->parse('main.subBlock3');
-
- /*recursively parse the "main" block of the template (the whole page)...*/
- /*and all sub blocks within "main".*/
- /*This will parse subBlock1, subBlock2, and subBlock3 regardless of whether */
- /*they have parsed before or not*/
- $xitpl->rparse('main');
-
- /*send the final page out to the browser*/
- $xitpl->out('main');
- ?>