]> git.llucax.com Git - software/bife/hit.git/commitdiff
- Improved example. 1.0.0beta1
authorLeandro Lucarella <llucax@gmail.com>
Sun, 6 Jul 2003 04:55:57 +0000 (04:55 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 6 Jul 2003 04:55:57 +0000 (04:55 +0000)
- Added a ROADMAP.
- Updated package.xml.

ROADMAP [new file with mode: 0644]
examples/hooks/body.tpl.html [new file with mode: 0644]
examples/hooks/link.tpl.html [new file with mode: 0644]
examples/hooks/table/body.tpl.html [new file with mode: 0644]
examples/hooks/table/cell.tpl.html [new file with mode: 0644]
examples/hooks/table/row.tpl.html [new file with mode: 0644]
examples/index.php
package.xml

diff --git a/ROADMAP b/ROADMAP
new file mode 100644 (file)
index 0000000..7f94e08
--- /dev/null
+++ b/ROADMAP
@@ -0,0 +1,7 @@
+$Id$
+
+
+Version 1.0.0
+=============
+    - Write some documentation.
+
diff --git a/examples/hooks/body.tpl.html b/examples/hooks/body.tpl.html
new file mode 100644 (file)
index 0000000..2c564a6
--- /dev/null
@@ -0,0 +1,10 @@
+<HTML>
+    <HEAD>
+        <TITLE>{TITLE}</TITLE>
+    </HEAD>
+    <BODY>
+        {LINK}
+        <HR>
+        {BODY}
+    </BODY>
+</HTML>
diff --git a/examples/hooks/link.tpl.html b/examples/hooks/link.tpl.html
new file mode 100644 (file)
index 0000000..fcce3df
--- /dev/null
@@ -0,0 +1 @@
+<A href="{PAGE}">{NAME}</A>
diff --git a/examples/hooks/table/body.tpl.html b/examples/hooks/table/body.tpl.html
new file mode 100644 (file)
index 0000000..d6c8132
--- /dev/null
@@ -0,0 +1,3 @@
+<TABLE border="1" cellpadding="5">
+    {ROWS}
+</TABLE>
diff --git a/examples/hooks/table/cell.tpl.html b/examples/hooks/table/cell.tpl.html
new file mode 100644 (file)
index 0000000..d4889a9
--- /dev/null
@@ -0,0 +1 @@
+<TD>{CELL}</TD>
diff --git a/examples/hooks/table/row.tpl.html b/examples/hooks/table/row.tpl.html
new file mode 100644 (file)
index 0000000..2889643
--- /dev/null
@@ -0,0 +1 @@
+<TR>{ROW}</TR>
index 0e6aa250e4b92147e3194db3b11c455732b72502..ba7c74ee149f8291aca8ba726c475e9cc1cdd7ee 100644 (file)
@@ -1,5 +1,5 @@
-<?
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker:
 // +--------------------------------------------------------------------+
 // |                       BIFE - Buil It FastEr                        |
 // +--------------------------------------------------------------------+
 // +--------------------------------------------------------------------+
 // |                       BIFE - Buil It FastEr                        |
 // +--------------------------------------------------------------------+
 
 // This is a simple test and example of HTML_Template_HIT
 
 
 // This is a simple test and example of HTML_Template_HIT
 
+// Inicialization {{{
 ini_set('include_path', '../src:'.ini_get('include_path'));
 umask('002');
 ini_set('include_path', '../src:'.ini_get('include_path'));
 umask('002');
-
 require_once 'HTML/Template/HIT.php';
 require_once 'HTML/Template/HIT.php';
-
 $hit =& new HTML_Template_HIT('hooks');
 $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(
 echo $hit->parse(
     'body',
     array(
-        'ROWS' => $hit->popBuffer('row'),
-        'TITLE' => 'HOLA MUNDO!!!',
+        'TITLE' => 'HELLO WORLD!!!',
+        'BODY'  => $body,
+        'LINK'  => $link,
     )
 );
     )
 );
+// }}}
 
 ?>
 
 ?>
index 310e65667b6417c5933770b37250669725d9caeb..d5299000d367e3fab7a8fdeec1a9d1d0b4cde2d2 100644 (file)
@@ -3,9 +3,9 @@
 <package version="1.0">
     <name>HTML_Template_HIT</name>
     <summary>Hooks vs IT Template Engine</summary>
 <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>
     </description>
     <license>GPL</license>
     <maintainers>
@@ -21,7 +21,7 @@ like IT so every chunk must be in a separated file if you want to iterate it.
         <version>1.0.0beta1</version>
         <date>2003-06-30</date>
         <state>beta</state>
         <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 -->
         <provides type="class" name="HTML_Template_HIT"/>
         <filelist>
             <!-- PHP -->
@@ -31,8 +31,12 @@ like IT so every chunk must be in a separated file if you want to iterate it.
                 <file>index.php</file>
                 <dir name="hooks">
                     <file>body.tpl.html</file>
                 <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>
                 </dir>
             </dir>
         </filelist>