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


PHP Smarty_Internal_Debug::start_template方法代码示例

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


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

示例1: getInlineSubTemplate

 /**
  * Template code runtime function to set up an inline subtemplate
  *
  * @param string  $template the resource handle of the template file
  * @param mixed   $cache_id cache id to be used with this template
  * @param mixed   $compile_id compile id to be used with this template
  * @param integer $caching cache mode
  * @param integer $cache_lifetime life time of cache data
  * @param array   $data passed parameter template variables
  * @param int     $parent_scope scope in which {include} should execute
  * @param string  $hash nocache hash code
  * @param string  $content_func name of content function
  *
  * @returns object template content
  */
 public function getInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $hash, $content_func)
 {
     $tpl = $this->setupSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope);
     $tpl->properties['nocache_hash'] = $hash;
     if (!isset($this->smarty->template_objects[$tpl->templateId])) {
         $this->smarty->template_objects[$tpl->templateId] = $tpl;
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_template($tpl);
         Smarty_Internal_Debug::start_render($tpl);
     }
     $tpl->properties['unifunc'] = $content_func;
     $output = $tpl->getRenderedTemplateCode();
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_template($tpl);
         Smarty_Internal_Debug::end_render($tpl);
     }
     if (!empty($tpl->properties['file_dependency'])) {
         $this->properties['file_dependency'] = array_merge($this->properties['file_dependency'], $tpl->properties['file_dependency']);
     }
     $this->properties['tpl_function'] = $tpl->properties['tpl_function'];
     return str_replace($tpl->properties['nocache_hash'], $this->properties['nocache_hash'], $output);
 }
开发者ID:hejxing,项目名称:jt,代码行数:38,代码来源:smarty_internal_template.php

示例2: render

 /**
  * render template
  *
  * @param  bool                         $display       true: display, false: fetch
  * @param bool                          $isSubTemplate
  * @param bool                          $runOutputFilter
  * @param null|\Smarty_Internal_Context $_contextObjIn optional buffer object
  *
  * @return string
  * @throws \SmartyException
  */
 public function render($display = false, $isSubTemplate = false, $runOutputFilter = true, Smarty_Internal_Context $_contextObjIn = null)
 {
     $level = ob_get_level();
     try {
         if (!isset($this->source)) {
             $this->source = Smarty_Template_Source::load($this);
         }
         // checks if template exists
         if (!$this->source->exists) {
             if ($this->parent instanceof Smarty_Internal_Template) {
                 $parent_resource = " in '{$this->parent->template_resource}'";
             } else {
                 $parent_resource = '';
             }
             throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}");
         }
         if ($this->smarty->debugging) {
             Smarty_Internal_Debug::start_template($this);
         }
         $this->context = $_contextObjIn === null ? new Smarty_Internal_Context() : $_contextObjIn;
         // merge all variable scopes into template
         if (!$isSubTemplate) {
             $savedErrorLevel = isset($this->smarty->error_reporting) ? error_reporting($this->smarty->error_reporting) : null;
             // save local variables
             $savedTplVars = $this->tpl_vars;
             $savedConfigVars = $this->config_vars;
             $ptr_array = array($this);
             $ptr = $this;
             while (isset($ptr->parent)) {
                 $ptr_array[] = $ptr = $ptr->parent;
             }
             $ptr_array = array_reverse($ptr_array);
             $parent_ptr = reset($ptr_array);
             $tpl_vars = $parent_ptr->tpl_vars;
             $config_vars = $parent_ptr->config_vars;
             while ($parent_ptr = next($ptr_array)) {
                 if (!empty($parent_ptr->tpl_vars)) {
                     $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars);
                 }
                 if (!empty($parent_ptr->config_vars)) {
                     $config_vars = array_merge($config_vars, $parent_ptr->config_vars);
                 }
             }
             if (!empty(Smarty::$global_tpl_vars)) {
                 $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars);
             }
             $this->tpl_vars = $tpl_vars;
             $this->config_vars = $config_vars;
         } else {
             $savedTplVars = null;
             $savedConfigVars = null;
             $savedErrorLevel = null;
         }
         // dummy local smarty variable
         if (!isset($this->tpl_vars['smarty'])) {
             $this->tpl_vars['smarty'] = new Smarty_Variable();
         }
         // disable caching for evaluated code
         if ($this->source->recompiled) {
             $this->caching = false;
         }
         $_caching = $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED;
         // read from cache or render
         if ($_caching && !isset($this->cached)) {
             $this->cached = Smarty_Template_Cached::load($this);
         }
         if (!$_caching || !$this->cached->valid) {
             // render template (not loaded and not in cache)
             if ($this->smarty->debugging) {
                 Smarty_Internal_Debug::start_render($this, null);
             }
             if (isset($this->cached)) {
                 $_savedContext = $this->context;
                 $this->context = new Smarty_Internal_Context(true);
             }
             if (!$this->source->uncompiled) {
                 // render compiled code
                 if (!isset($this->compiled)) {
                     $this->compiled = Smarty_Template_Compiled::load($this);
                 }
                 $this->compiled->render($this);
             } else {
                 $this->source->renderUncompiled($this);
             }
             if ($this->smarty->debugging) {
                 Smarty_Internal_Debug::end_render($this, null);
             }
             // write to cache when necessary
             if ($_caching && !$this->source->recompiled) {
//.........这里部分代码省略.........
开发者ID:uwetews,项目名称:smarty-hhvm,代码行数:101,代码来源:smarty_internal_template.php

示例3: getInlineSubTemplate

 /**
  * Template code runtime function to set up an inline subtemplate
  *
  * @param string  $template       the resource handle of the template file
  * @param mixed   $cache_id       cache id to be used with this template
  * @param mixed   $compile_id     compile id to be used with this template
  * @param integer $caching        cache mode
  * @param integer $cache_lifetime life time of cache data
  * @param array   $data           passed parameter template variables
  * @param         $_scope
  * @param         $parent
  * @param string  $content_func   name of content function
  *
  * @param bool    $newBuffer
  *
  * @return object template content
  */
 public function getInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $_scope, $parent, $params, $newBuffer = false)
 {
     $tpl = $parent->smarty->setupTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $_scope, $parent);
     $tpl->context = $newBuffer ? new Smarty_Internal_Context() : $parent->context;
     if ($tpl->smarty->debugging) {
         Smarty_Internal_Debug::start_template($tpl);
         Smarty_Internal_Debug::start_render($tpl);
     }
     $this->getRenderedTemplateCode($tpl, $params['func']);
     if ($tpl->smarty->debugging) {
         Smarty_Internal_Debug::end_template($tpl);
         Smarty_Internal_Debug::end_render($tpl);
     }
     if ($newBuffer) {
         $output = $tpl->context->getContent();
         $tpl->context = null;
         return $output;
     }
     $tpl->context = null;
     return '';
 }
开发者ID:uwetews,项目名称:smarty-hhvm,代码行数:38,代码来源:smarty_internal_runtime.php

示例4: render

 /**
  * render template
  * @param  bool $merge_tpl_vars if true parent template variables merged in to local scope
  * @param  bool $no_output_filter if true do not run output filter
  * @param  bool $display true: display, false: fetch null: subtemplate
  * @throws Exception
  * @throws SmartyException
  * @return string rendered template output
  */
 public function render($merge_tpl_vars = FALSE, $no_output_filter = TRUE, $display = NULL)
 {
     $parentIsTpl = $this->parent instanceof Smarty_Internal_Template;
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_template($this, $display);
     }
     $save_tpl_vars = NULL;
     $save_config_vars = NULL;
     // merge all variable scopes into template
     if ($merge_tpl_vars) {
         // save local variables
         $save_tpl_vars = $this->tpl_vars;
         $save_config_vars = $this->config_vars;
         $ptr_array = [$this];
         $ptr = $this;
         while (isset($ptr->parent)) {
             $ptr_array[] = $ptr = $ptr->parent;
         }
         $ptr_array = array_reverse($ptr_array);
         $parent_ptr = reset($ptr_array);
         $tpl_vars = $parent_ptr->tpl_vars;
         $config_vars = $parent_ptr->config_vars;
         while ($parent_ptr = next($ptr_array)) {
             if (!empty($parent_ptr->tpl_vars)) {
                 $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars);
             }
             if (!empty($parent_ptr->config_vars)) {
                 $config_vars = array_merge($config_vars, $parent_ptr->config_vars);
             }
         }
         if (!empty(Smarty::$global_tpl_vars)) {
             $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars);
         }
         $this->tpl_vars = $tpl_vars;
         $this->config_vars = $config_vars;
     }
     // dummy local smarty variable
     if (!isset($this->tpl_vars['smarty'])) {
         $this->tpl_vars['smarty'] = new Smarty_Variable();
     }
     $_smarty_old_error_level = isset($this->smarty->error_reporting) ? error_reporting($this->smarty->error_reporting) : NULL;
     // check URL debugging control
     if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {
         Smarty_Internal_Debug::debugUrl($this);
     }
     if (!isset($this->source)) {
         $this->loadSource();
     }
     // checks if template exists
     if (!$this->source->exists) {
         if ($parentIsTpl) {
             $parent_resource = " in '{$this->parent->template_resource}'";
         } else {
             $parent_resource = '';
         }
         throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}");
     }
     // disable caching for evaluated code
     if ($this->source->recompiled) {
         $this->caching = FALSE;
     }
     // read from cache or render
     $isCacheTpl = $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED;
     if ($isCacheTpl) {
         if (!isset($this->cached)) {
             $this->loadCached();
         }
         $this->cached->isCached($this);
     }
     if (!$isCacheTpl || !$this->cached->valid) {
         if ($isCacheTpl) {
             $this->properties['tpl_function'] = [];
         }
         // render template (not loaded and not in cache)
         if ($this->smarty->debugging) {
             Smarty_Internal_Debug::start_render($this);
         }
         if (!$this->source->uncompiled) {
             // render compiled code
             if (!isset($this->compiled)) {
                 $this->loadCompiled();
             }
             $content = $this->compiled->render($this);
         } else {
             $content = $this->source->renderUncompiled($this);
         }
         if (!$this->source->recompiled && empty($this->properties['file_dependency'][$this->source->uid])) {
             $this->properties['file_dependency'][$this->source->uid] = [$this->source->filepath, $this->source->timestamp, $this->source->type];
         }
         if ($parentIsTpl) {
             $this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']);
//.........这里部分代码省略.........
开发者ID:rendix2,项目名称:QW_MVS,代码行数:101,代码来源:smarty_internal_template.php


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