| // +--------------------------------------------------------------------+ // // $Id$ // // +X2C includes require_once 'BIFE/Fallback.php'; // ~X2C // +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. * * @package BIFE * @access public */ class BIFE_Translate extends BIFE_Fallback { // ~X2C // +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 { $name = "bife_{$this->name}"; if ($template->exists($name, '')) { $this->attrs['CONTENTS'] = $this->renderContents($template); $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"; } else { $out .= "/>"; } } return $out; } // -X2C } // -X2C Class :Translate ?>