]> git.llucax.com Git - software/bife/bife-all.git/commitdiff
- Improved example.
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.

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

diff --git a/hit/ROADMAP b/hit/ROADMAP
new file mode 100644 (file)
index 0000000..7f94e08
--- /dev/null
@@ -0,0 +1,7 @@
+$Id$
+
+
+Version 1.0.0
+=============
+    - Write some documentation.
+
index 2481bfaf64d82e23ba4389c7d7a6a69f650d555b..2c564a60a692f7399ca510d3667e4a1df8563867 100644 (file)
@@ -3,8 +3,8 @@
         <TITLE>{TITLE}</TITLE>
     </HEAD>
     <BODY>
-        <TABLE border="1" cellpadding="5">
-            {ROWS}
-        </TABLE>
+        {LINK}
+        <HR>
+        {BODY}
     </BODY>
 </HTML>
diff --git a/hit/examples/hooks/link.tpl.html b/hit/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/hit/examples/hooks/table/body.tpl.html b/hit/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>
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                        |
 // +--------------------------------------------------------------------+
 
 // 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,
     )
 );
+// }}}
 
 ?>
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>
-    <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>
@@ -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>
-        <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 -->
@@ -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>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>