当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Template::_getSmartyObj方法代码示例

本文整理汇总了PHP中Smarty_Internal_Template::_getSmartyObj方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template::_getSmartyObj方法的具体用法?PHP Smarty_Internal_Template::_getSmartyObj怎么用?PHP Smarty_Internal_Template::_getSmartyObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty_Internal_Template的用法示例。


在下文中一共展示了Smarty_Internal_Template::_getSmartyObj方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_debug

 /**
  * Opens a window for the Smarty Debugging Console and display the data
  *
  * @param Smarty_Internal_Template|Smarty $obj object to debug
  * @param bool                            $full
  */
 public function display_debug($obj, $full = false)
 {
     if (!$full) {
         $this->offset++;
         $savedIndex = $this->index;
         $this->index = 9999;
     }
     $smarty = $obj->_getSmartyObj();
     // create fresh instance of smarty for displaying the debug console
     // to avoid problems if the application did overload the Smarty class
     $debObj = new Smarty();
     // copy the working dirs from application
     $debObj->setCompileDir($smarty->getCompileDir());
     // init properties by hand as user may have edited the original Smarty class
     $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
     $debObj->force_compile = false;
     $debObj->compile_check = true;
     $debObj->left_delimiter = '{';
     $debObj->right_delimiter = '}';
     $debObj->security_policy = null;
     $debObj->debugging = false;
     $debObj->debugging_ctrl = 'NONE';
     $debObj->error_reporting = E_ALL & ~E_NOTICE;
     $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
     $debObj->registered_plugins = array();
     $debObj->registered_resources = array();
     $debObj->registered_filters = array();
     $debObj->autoload_filters = array();
     $debObj->default_modifiers = array();
     $debObj->escape_html = true;
     $debObj->caching = false;
     $debObj->compile_id = null;
     $debObj->cache_id = null;
     // prepare information of assigned variables
     $ptr = $this->get_debug_vars($obj);
     $_assigned_vars = $ptr->tpl_vars;
     ksort($_assigned_vars);
     $_config_vars = $ptr->config_vars;
     ksort($_config_vars);
     $debugging = $smarty->debugging;
     $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
     if ($obj->_isTplObj()) {
         $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
     }
     if ($obj->_objType == 1 || $full) {
         $_template->assign('template_data', $this->template_data[$this->index]);
     } else {
         $_template->assign('template_data', null);
     }
     $_template->assign('assigned_vars', $_assigned_vars);
     $_template->assign('config_vars', $_config_vars);
     $_template->assign('execution_time', microtime(true) - $smarty->start_time);
     $_template->assign('display_mode', $debugging == 2 || !$full);
     $_template->assign('offset', $this->offset * 50);
     echo $_template->fetch();
     if (isset($full)) {
         $this->index--;
     }
     if (!$full) {
         $this->index = $savedIndex;
     }
 }
开发者ID:jimjag,项目名称:smarty,代码行数:68,代码来源:smarty_internal_debug.php

示例2: getUniqueTemplateName

 /**
  * modify template_resource according to resource handlers specifications
  *
  * @param  \Smarty_Internal_Template|\Smarty $obj               Smarty instance
  * @param  string                            $template_resource template_resource to extract resource handler and name of
  *
  * @return string unique resource name
  */
 public static function getUniqueTemplateName($obj, $template_resource)
 {
     $smarty = $obj->_getSmartyObj();
     list($name, $type) = self::parseResourceName($template_resource, $smarty->default_resource_type);
     // TODO: optimize for Smarty's internal resource types
     $resource = Smarty_Resource::load($smarty, $type);
     // go relative to a given template?
     $_file_is_dotted = $name[0] == '.' && ($name[1] == '.' || $name[1] == '/');
     if ($obj->_isTplObj() && $_file_is_dotted && ($obj->source->type == 'file' || $obj->parent->source->type == 'extends')) {
         $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . $smarty->ds . $name);
     }
     return $resource->buildUniqueResourceName($smarty, $name);
 }
开发者ID:jimjag,项目名称:smarty,代码行数:21,代码来源:smarty_resource.php


注:本文中的Smarty_Internal_Template::_getSmartyObj方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。