public function render($context = array()) { global $opac_authorities_templates_folder; if (!$opac_authorities_templates_folder) { $opac_authorities_templates_folder = "./includes/templates/authorities/common"; } $template_path = $opac_authorities_templates_folder . "/" . $this->get_type_autority() . ".html"; if (!file_exists($template_path)) { $template_path = "./includes/templates/authorities/common/" . $this->get_type_autority() . ".html"; } if (file_exists($opac_authorities_templates_folder . "/" . $this->get_type_autority() . "_subst.html")) { $template_path = $opac_authorities_templates_folder . "/" . $this->get_type_autority() . "_subst.html"; } if (file_exists($template_path)) { $h2o = new H2o($template_path); $h2o->addLookup(array($this, "lookup")); echo $h2o->render($context); } }
$obj = call_user_func_array(array($obj, $attribute), array()); } else { if (method_exists($obj, "get_" . $attribute)) { $obj = call_user_func_array(array($obj, "get_" . $attribute), array()); } else { if (method_exists($obj, "is_" . $attribute)) { $obj = call_user_func_array(array($obj, "is_" . $attribute), array()); } else { $obj = null; } } } } } else { $obj = null; break; } } } } return $obj; } h2o::addTag(array("sqlvalue")); h2o::addTag(array("sparqlvalue")); h2o::addTag(array("tplnotice")); h2o::addFilter(array('pmb_StringFilters')); h2o::addFilter(array('pmb_DateFilters')); H2o::addLookup("messagesLookup"); H2o::addLookup("globalLookup"); H2o::addLookup("recursive_lookup");
public function render($context = array()) { $template_path = "./includes/templates/authorities/" . $this->get_string_type_object() . ".html"; if (file_exists("./includes/templates/authorities/" . $this->get_string_type_object() . "_subst.html")) { $template_path = "./includes/templates/authorities/" . $this->get_string_type_object() . "_subst.html"; } if (file_exists($template_path)) { $h2o = new H2o($template_path); $h2o->addLookup(array($this, "lookup")); echo $h2o->render($context); } }
private static function render($notice_id, $tpl) { $h2o = new H2o($tpl); $h2o->addLookup("record_display::lookup"); $h2o->set(array('notice_id' => $notice_id)); return $h2o->render(); }
$notice_id = $query_stream->close(); $notice_id = $notice_id + 0; $query = "select count(notice_id) from notices where notice_id=" . $notice_id; $result = mysql_query($query, $dbh); if ($result && mysql_result($result, 0)) { require_once "{$class_path}/notice_tpl_gen.class.php"; $struct = array(); $tpl = new notice_tpl_gen($this->id_tpl); $this->content = $tpl->build_notice($notice_id); $stream->write($this->content); } } } function globalLookup($name, $context) { $global = str_replace(":global.", "", $name); if ($global != $name) { global ${$global}; if (isset(${$global})) { return ${$global}; } } return null; } h2o::addTag(array("sqlvalue")); h2o::addTag(array("sparqlvalue")); h2o::addTag(array("tplnotice")); h2o::addFilter(array('pmb_StringFilters')); h2o::addFilter(array('pmb_DateFilters')); H2o::addLookup("globalLookup");
{ return array('h2o' => new H2o_Info()); } } /** * Convient wrapper for loading template file or string * @param $name * @param $options - H2o options * @return Instance of H2o Template */ function h2o($name, $options = array()) { $is_file = '/([^\\s]*?)(\\.[^.\\s]*$)/'; if (!preg_match($is_file, $name)) { return H2o::parseString($name); } $instance = new H2o($name, $options); return $instance; } function messagesLookup($name, $context) { global $msg; $value = null; $code = str_replace(":msg.", "", $name); if ($code != $name && isset($msg[$code])) { $value = $msg[$code]; } return $value; } H2o::addLookup("messagesLookup");