本文整理汇总了PHP中H2o::addLookup方法的典型用法代码示例。如果您正苦于以下问题:PHP H2o::addLookup方法的具体用法?PHP H2o::addLookup怎么用?PHP H2o::addLookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H2o
的用法示例。
在下文中一共展示了H2o::addLookup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
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);
}
}
示例2: call_user_func_array
$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");
示例3: render
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);
}
}
示例4: render
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();
}
示例5: count
$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");
示例6: array
{
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");