本文整理汇总了PHP中Smarty_Internal_Debug::end_template方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Debug::end_template方法的具体用法?PHP Smarty_Internal_Debug::end_template怎么用?PHP Smarty_Internal_Debug::end_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Debug
的用法示例。
在下文中一共展示了Smarty_Internal_Debug::end_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);
}
示例2: render
//.........这里部分代码省略.........
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) {
if ($this->smarty->debugging) {
Smarty_Internal_Debug::start_cache($this);
}
// write cache file content
if ($runOutputFilter && !$this->context->hasNocacheCode && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
$this->cached->writeCachedContent($this, $this->context, Smarty_Internal_Filter_Handler::runFilter('output', $this->context->getContent(), $this));
} else {
$this->cached->writeCachedContent($this, $this->context);
}
$this->context = $_savedContext;
$compile_check = $this->smarty->compile_check;
$this->smarty->compile_check = false;
if (!$this->cached->processed) {
$this->cached->process($this);
}
$this->smarty->compile_check = $compile_check;
$this->cached->compiledTplObj->getRenderedTemplateCode($this);
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_cache($this);
}
}
} else {
if ($this->smarty->debugging) {
Smarty_Internal_Debug::start_cache($this);
}
$this->cached->render($this);
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_cache($this);
}
}
if ($runOutputFilter && (!$this->caching || $this->context->hasNocacheCode || $this->source->recompiled) && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
$this->context->flushBuffer();
$this->context->content = Smarty_Internal_Filter_Handler::runFilter('output', $this->context->content, $this);
}
// display or fetch
if ($display) {
$this->context->endBuffer();
if ($this->caching && $this->smarty->cache_modified_check) {
$this->cached->cacheModifiedCheck($this, $this->context->content);
} else {
echo $this->context->content;
}
$this->context = null;
}
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_template($this);
}
if ($display) {
// debug output
if ($this->smarty->debugging) {
Smarty_Internal_Debug::display_debug($this, true);
}
}
if (!$isSubTemplate) {
// restore local variables
$this->tpl_vars = $savedTplVars;
$this->config_vars = $savedConfigVars;
if (isset($savedErrorLevel)) {
error_reporting($savedErrorLevel);
}
}
} catch (Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
if (!$display && $_contextObjIn === null) {
// return fetched content
$this->context->endBuffer();
$output = $this->context->content;
$this->context = null;
return $output;
}
$this->context = null;
return '';
}
示例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 '';
}
示例4: render
//.........这里部分代码省略.........
}
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']);
//$this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']);
}
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_render($this);
}
// write to cache when necessary
if (!$this->source->recompiled && $isCacheTpl) {
if ($this->smarty->debugging) {
Smarty_Internal_Debug::start_cache($this);
}
$this->cached->updateCache($this, $content, $no_output_filter);
$compile_check = $this->smarty->compile_check;
$this->smarty->compile_check = FALSE;
if ($parentIsTpl) {
$this->properties['tpl_function'] = $this->parent->properties['tpl_function'];
}
if (!$this->cached->processed) {
$this->cached->process($this);
}
$this->smarty->compile_check = $compile_check;
$content = $this->getRenderedTemplateCode();
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_cache($this);
}
} else {
if (!empty($this->properties['nocache_hash']) && !empty($this->parent->properties['nocache_hash'])) {
// replace nocache_hash
$content = str_replace("{$this->properties['nocache_hash']}", $this->parent->properties['nocache_hash'], $content);
$this->parent->has_nocache_code = $this->parent->has_nocache_code || $this->has_nocache_code;
}
}
} else {
if ($this->smarty->debugging) {
Smarty_Internal_Debug::start_cache($this);
}
$content = $this->cached->render($this);
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_cache($this);
}
}
if ((!$this->caching || $this->has_nocache_code || $this->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
$content = Smarty_Internal_Filter_Handler::runFilter('output', $content, $this);
}
if (isset($_smarty_old_error_level)) {
error_reporting($_smarty_old_error_level);
}
// display or fetch
if ($display) {
if ($this->caching && $this->smarty->cache_modified_check) {
$this->cached->cacheModifiedCheck($this, $content);
} else {
echo $content;
}
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_template($this);
}
// debug output
if ($this->smarty->debugging) {
Smarty_Internal_Debug::display_debug($this, TRUE);
}
if ($merge_tpl_vars) {
// restore local variables
$this->tpl_vars = $save_tpl_vars;
$this->config_vars = $save_config_vars;
}
return '';
} else {
if ($merge_tpl_vars) {
// restore local variables
$this->tpl_vars = $save_tpl_vars;
$this->config_vars = $save_config_vars;
}
if ($this->smarty->debugging) {
Smarty_Internal_Debug::end_template($this);
}
if ($this->smarty->debugging == 2 and $display === FALSE) {
if ($this->smarty->debugging) {
Smarty_Internal_Debug::display_debug($this, TRUE);
}
}
if ($parentIsTpl) {
$this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']);
foreach ($this->required_plugins as $code => $tmp1) {
foreach ($tmp1 as $name => $tmp) {
foreach ($tmp as $type => $data) {
$this->parent->required_plugins[$code][$name][$type] = $data;
}
}
}
}
// return cache content
return $content;
}
}