本文整理汇总了PHP中Smarty_Internal_Debug::debugUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Debug::debugUrl方法的具体用法?PHP Smarty_Internal_Debug::debugUrl怎么用?PHP Smarty_Internal_Debug::debugUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Debug
的用法示例。
在下文中一共展示了Smarty_Internal_Debug::debugUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
//.........这里部分代码省略.........
示例2: fetch
/**
* fetches a rendered Smarty template
*
* @param string $template the resource handle of the template file or template object
* @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 object $parent next higher level of Smarty variables
* @param bool $display true: display, false: fetch
* @param bool $merge_tpl_vars not used - left for BC
* @param bool $no_output_filter not used - left for BC
*
* @throws Exception
* @throws SmartyException
* @return string rendered template output
*/
public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
{
// check URL debugging control
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
Smarty_Internal_Debug::debugUrl($this);
}
if (!is_object($template)) {
$template = $this->setupTemplate($template, $cache_id, $compile_id, $this->caching, $this->cache_lifetime, array(), null, $parent, $display ? 2 : 3);
} else {
if ((bool) $template->caching !== (bool) $this->caching) {
unset($template->compiled);
}
// set caching in template object
$template->caching = $this->caching;
}
// fetch template content
return $template->render($display);
}