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


PHP Smarty_Internal_Template::_isDataObj方法代碼示例

本文整理匯總了PHP中Smarty_Internal_Template::_isDataObj方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Template::_isDataObj方法的具體用法?PHP Smarty_Internal_Template::_isDataObj怎麽用?PHP Smarty_Internal_Template::_isDataObj使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Smarty_Internal_Template的用法示例。


在下文中一共展示了Smarty_Internal_Template::_isDataObj方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_debug_vars

 /**
  * Recursively gets variables from all template/data scopes
  *
  * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug
  *
  * @return StdClass
  */
 public function get_debug_vars($obj)
 {
     $config_vars = array();
     foreach ($obj->config_vars as $key => $var) {
         $config_vars[$key]['value'] = $var;
         if ($obj->_isTplObj()) {
             $config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
         } elseif ($obj->_isDataObj()) {
             $tpl_vars[$key]['scope'] = $obj->dataObjectName;
         } else {
             $config_vars[$key]['scope'] = 'Smarty object';
         }
     }
     $tpl_vars = array();
     foreach ($obj->tpl_vars as $key => $var) {
         foreach ($var as $varkey => $varvalue) {
             if ($varkey == 'value') {
                 $tpl_vars[$key][$varkey] = $varvalue;
             } else {
                 if ($varkey == 'nocache') {
                     if ($varvalue == true) {
                         $tpl_vars[$key][$varkey] = $varvalue;
                     }
                 } else {
                     if ($varkey != 'scope' || $varvalue !== 0) {
                         $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
                     }
                 }
             }
         }
         if ($obj->_isTplObj()) {
             $tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
         } elseif ($obj->_isDataObj()) {
             $tpl_vars[$key]['scope'] = $obj->dataObjectName;
         } else {
             $tpl_vars[$key]['scope'] = 'Smarty object';
         }
     }
     if (isset($obj->parent)) {
         $parent = $this->get_debug_vars($obj->parent);
         foreach ($parent->tpl_vars as $name => $pvar) {
             if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
                 $tpl_vars[$name]['scope'] = $pvar['scope'];
             }
         }
         $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
         foreach ($parent->config_vars as $name => $pvar) {
             if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
                 $config_vars[$name]['scope'] = $pvar['scope'];
             }
         }
         $config_vars = array_merge($parent->config_vars, $config_vars);
     } else {
         foreach (Smarty::$global_tpl_vars as $key => $var) {
             if (!array_key_exists($key, $tpl_vars)) {
                 foreach ($var as $varkey => $varvalue) {
                     if ($varkey == 'value') {
                         $tpl_vars[$key][$varkey] = $varvalue;
                     } else {
                         if ($varkey == 'nocache') {
                             if ($varvalue == true) {
                                 $tpl_vars[$key][$varkey] = $varvalue;
                             }
                         } else {
                             if ($varkey != 'scope' || $varvalue !== 0) {
                                 $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
                             }
                         }
                     }
                 }
                 $tpl_vars[$key]['scope'] = 'Global';
             }
         }
     }
     return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
 }
開發者ID:jimjag,項目名稱:smarty,代碼行數:83,代碼來源:smarty_internal_debug.php


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