| // +--------------------------------------------------------------------+ // // $Id$ // // This is a simple test and example of HTML_Template_HIT // Inicialization {{{ ini_set('include_path', '../src:'.ini_get('include_path')); umask('002'); require_once 'HTML/Template/HIT.php'; $hit =& new HTML_Template_HIT('hooks'); // }}} // Looks if we want to show the source {{{ if (@$_REQUEST['s']) { $body = highlight_file($_SERVER['SCRIPT_FILENAME'], true); // }}} // If not, we make a table using the template {{{ } else { $hit->pushGroup('table'); for ($i = 0; $i < 20; $i++) { for ($j = 0; $j < 20; $j++) { $hit->parseBuffered('cell', 'CELL', "$i,$j"); } $hit->parseBuffered('row', 'ROW', $hit->popBuffer('cell')); } $body = $hit->parse('body', 'ROWS', $hit->popBuffer('row')); $hit->popGroup('table'); } // }}} // Now a link, to look at the source or to look at the results {{{ if (@$_REQUEST['s']) { $link = $hit->parse('link', array('NAME' => 'View results', 'PAGE' => '?s=0')); } else { $link = $hit->parse('link', array('NAME' => 'View source', 'PAGE' => '?s=1')); } // }}} // We put all in the body and prints it {{{ echo $hit->parse( 'body', array( 'TITLE' => 'HELLO WORLD!!!', 'BODY' => $body, 'LINK' => $link, ) ); // }}} ?>