- <?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/assign.tpl');
-
- /*assign a value to a template variable.*\
- /*In this example {NAME} will be replaced with "XiTemplate"*/
- $xitpl->assign('NAME', 'XiTemplate');
-
- /*multidimensional array*/
- $myArray = array
- (
- 'name' => 'Jim',
- 'lastName' => 'Grill',
- 'address' => array
- (
- 'street' => 'One XiTemplate Way',
- 'city' => 'Paradise',
- 'state' => 'Hawaii',
- 'zip' => '12345'
- ),
- 'age' => 'too old'
- );
-
- /*assign the array to a template variable*/
- $xitpl->assign('MYARRAY', $myArray);
-
- /*parse the "main" block of the page (the whole page)*/
- $xitpl->parse('main');
-
- /*send the final page out to the browser*/
- $xitpl->out('main');
- ?>