-<?
+<?php
// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
// +--------------------------------------------------------------------+
// | BIFE - Buil It FastEr |
// | along with Hooks; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------+
-// | Created: miƩ jun 18 01:05:57 ART 2003 |
+// | Created: Wed May 17 18:16:54 ART 2003 |
// | Authors: Leandro Lucarella <luca@lugmen.org.ar> |
// +--------------------------------------------------------------------+
//
// $Id$
//
-// This is a simple test and example of HTML_Template_HIT
+// +X2C includes
+require_once 'BIFE/Fallback.php';
+// ~X2C
-$tmp = ini_get('include_path');
-ini_set('include_path', "../core:$tmp");
-unset($tmp);
-umask('002');
+// +X2C Class 7 :Translate
+/**
+ * This is a generic and simple (but very usefull) BIFE_Fallback implementation. Translate widgets using a template with it's name, prepended with 'bife_'. If not template is found, it copy the XML to the output.
+ *
+ * @access public
+ */
+class BIFE_Translate extends BIFE_Fallback {
+ // ~X2C
-require_once 'HTML/Template/HIT.php';
-
-$hit =& new HTML_Template_HIT('hooks');
-
-for ($i = 0; $i < 20; $i++) {
- for ($j = 0; $j < 20; $j++) {
- $hit->parseBuffered('cell', 'CELL', "$i,$j");
+ // +X2C Operation 12
+ /**
+ * Renders the widget.
+ *
+ * @param HTML_Template_HIT &$template Template to use to render the widget.
+ *
+ * @return string
+ * @access public
+ */
+ function render(&$template) // ~X2C
+ {
+ $this->attrs['CONTENTS'] = $this->renderContents($template);
+ $name = "bife_{$this->name}";
+ if ($template->exists($name, '')) {
+ $out = $template->parse($name, $this->attrs, '', '');
+ } else {
+ $name = $this->name;
+ $out = "<$name";
+ foreach ($this->attrs as $attr => $val) {
+ $out .= sprintf(' %s="%s"', $attr, $val);
+ }
+ $contents = $this->renderContents($template);
+ if ($contents !== '') {
+ $out .= ">$contents</$name>";
+ } else {
+ $out .= "/>";
+ }
+ }
+ return $out;
}
- $hit->parseBuffered('row', 'ROW', $hit->popBuffer('cell'));
-}
-echo $hit->parse(
- 'body',
- array(
- 'ROWS' => $hit->popBuffer('row'),
- 'TITLE' => 'HOLA MUNDO!!!',
- )
-);
+ // -X2C
+
+} // -X2C Class :Translate
-?>
+?>
\ No newline at end of file