當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTML_Template_Flexy::activeEngine方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:roojs,項目名稱:pear,代碼行數:81,代碼來源:Flexy.php


注:本文中的HTML_Template_Flexy::activeEngine方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。