本文整理汇总了PHP中HTML_Template_Flexy::activeEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_Flexy::activeEngine方法的具体用法?PHP HTML_Template_Flexy::activeEngine怎么用?PHP HTML_Template_Flexy::activeEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Template_Flexy
的用法示例。
在下文中一共展示了HTML_Template_Flexy::activeEngine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputObject
/**
* Outputs an object as $t
*
* for example the using simpletags the object's variable $t->test
* would map to {test}
*
* @version 01/12/14
* @access public
* @author Alan Knowles
* @param object to output
* @param array HTML_Template_Flexy_Elements (or any object that implements toHtml())
* @return none
*/
function outputObject(&$t, $elements = array())
{
if (!is_array($elements)) {
return $this->raiseError('second Argument to HTML_Template_Flexy::outputObject() was an ' . gettype($elements) . ', not an array', HTML_TEMPLATE_FLEXY_ERROR_INVALIDARGS, HTML_TEMPLATE_FLEXY_ERROR_DIE);
}
if (@$this->options['debug']) {
echo "output {$this->compiledTemplate}<BR>";
}
// this may disappear later it's a Backwards Compatibility fudge to try
// and deal with the first stupid design decision to not use a second argument
// to the method.
if (count($this->elements) && !count($elements)) {
$elements = $this->elements;
}
// end depreciated code
$this->elements = $this->getElements();
// Overlay values from $elements to $this->elements (which is created from the template)
// Remove keys with no corresponding value.
foreach ($elements as $k => $v) {
// Remove key-value pair from $this->elements if hasn't a value in $elements.
if (!$v) {
unset($this->elements[$k]);
}
// Add key-value pair to $this->$elements if it's not there already.
if (!isset($this->elements[$k])) {
$this->elements[$k] = $v;
continue;
}
// Call the clever element merger - that understands form values and
// how to display them...
$this->elements[$k] = $this->elements[$k]->merge($v);
}
//echo '<PRE>'; print_r(array($elements,$this->elements));
// we use PHP's error handler to hide errors in the template.
// use $options['strict'] - if you want to force declaration of
// all variables in the template
$_error_reporting = false;
if (!$this->options['strict']) {
$_error_reporting = error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
}
if (!is_readable($this->compiledTemplate)) {
return $this->raiseError("Could not open the template: <b>'{$this->compiledTemplate}'</b><BR>" . "Please check the file permissions on the directory and file ", HTML_TEMPLATE_FLEXY_ERROR_FILE, HTML_TEMPLATE_FLEXY_ERROR_DIE);
}
// are we using the assign api!
if (isset($this->assign)) {
if (!$t) {
$t = (object) $this->assign->variables;
}
extract($this->assign->variables);
foreach (array_keys($this->assign->references) as $_k) {
${$_k} =& $this->assign->references[$_k];
}
}
// used by Flexy Elements etc..
// note that we are using __ prefix, as this get's exposed to the running template..
$__old_engine = self::$activeEngine;
$this->initializeTranslator();
self::$activeEngine = $this;
//?? not needed?
$GLOBALS['_HTML_TEMPLATE_FLEXY']['options'] = $this->options;
// initialize the translator..
include $this->compiledTemplate;
self::$activeEngine = $__old_engine;
// Return the error handler to its previous state.
if ($_error_reporting !== false) {
error_reporting($_error_reporting);
}
}