-<?
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker:
// +--------------------------------------------------------------------+
// | BIFE - Buil It FastEr |
// +--------------------------------------------------------------------+
// 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);
+// }}}
-for ($i = 0; $i < 20; $i++) {
- for ($j = 0; $j < 20; $j++) {
- $hit->parseBuffered('cell', 'CELL', "$i,$j");
+// 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'));
}
- $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(
- 'ROWS' => $hit->popBuffer('row'),
- 'TITLE' => 'HOLA MUNDO!!!',
+ 'TITLE' => 'HELLO WORLD!!!',
+ 'BODY' => $body,
+ 'LINK' => $link,
)
);
+// }}}
?>
<package version="1.0">
<name>HTML_Template_HIT</name>
<summary>Hooks vs IT Template Engine</summary>
- <description>HIT is a simple, ultra fast template engine. It's based on
-a personal experiment called Hooks and IT Templates. It doesn't support blocks
-like IT so every chunk must be in a separated file if you want to iterate it.
+ <description>HIT is a simple, fast template engine. It's based ona a personal
+experiment called Hooks and IT Templates. It doesn't support blocks like IT
+so every chunk must be in a separated file if you want to iterate it.
</description>
<license>GPL</license>
<maintainers>
<version>1.0.0beta1</version>
<date>2003-06-30</date>
<state>beta</state>
- <notes>Check http://www.llucax.hn.org/desarrollo/bife/ for details.</notes>
+ <notes>Check http://bife.llucax.hn.org/ for details.</notes>
<provides type="class" name="HTML_Template_HIT"/>
<filelist>
<!-- PHP -->
<file>index.php</file>
<dir name="hooks">
<file>body.tpl.html</file>
- <file>cell.tpl.html</file>
- <file>row.tpl.html</file>
+ <file>link.tpl.html</file>
+ <dir name="table">
+ <file>body.tpl.html</file>
+ <file>cell.tpl.html</file>
+ <file>row.tpl.html</file>
+ </dir>
</dir>
</dir>
</filelist>