本文整理汇总了PHP中tpl::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP tpl::fetch方法的具体用法?PHP tpl::fetch怎么用?PHP tpl::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpl
的用法示例。
在下文中一共展示了tpl::fetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_function_include_clipcache
/**
* tpl {include_clipcache} function plugin
*
* Includes a template using private caching parameters. Must be registered as non-caching.
*
* @file function.include_clipcache.php
* @version 0.1.7 2006-May-11
* @since 2005-APR-08
*
* @author boots {jayboots ~ yahoo com}
* @copyright brainpower, boots, 2004-2006
* @license LGPL 2.1
* @link http://www.phpinsider.com/tpl-forum/viewtopic.php?p=19733#19733
*
* @param array $params
* @param tpl $tpl
*
* This function observes the following tag attributes (in $params):
*
* #param file required template file
* #param cache_id required specify cache build group
* #param cache_lifetime required time to live for template part/group
* #param ldelim optional specify the left delimiter to use for included content
* #param rdelim optional specify the right delimiter to use for included content
*/
function tpl_function_include_clipcache($params, &$tpl)
{
// validation
foreach (array('cache_id', 'file', 'cache_lifetime') as $required) {
if (!array_key_exists($required, $params)) {
$tpl->trigger_error("include_clipcache: '{$required}' param missing. Aborted.", E_USER_WARNING);
return;
}
}
// handle optional delimiters
foreach (array('rdelim' => $tpl->right_delimiter, 'ldelim' => $tpl->left_delimiter) as $optional => $default) {
${"_{$optional}"} = $default;
${$optional} = array_key_exists($optional, $params) ? $params[$optional] : $default;
}
$tpl->compile_check = false;
// save tpl environment as proposed by calling template
$_caching = $tpl->cache;
if (caching == 1) {
$tpl->cache = 2;
}
$_cache_lifetime = $tpl->cache_lifetime;
$tpl->cache_lifetime = $params['cache_lifetime'];
$tpl->left_delimiter = $ldelim;
$tpl->right_delimiter = $rdelim;
// run the requested clipcache template
$content = $tpl->fetch($params['file'], $params['cache_id']);
// restore tpl environment as proposed by calling template
$tpl->cache = $_caching;
$tpl->cache_lifetime = $_cache_lifetime;
$tpl->left_delimiter = $_ldelim;
$tpl->right_delimiter = $_rdelim;
return $content;
}
示例2: publish
/**
* Publish the module to shown
*
* @return string The fetched view
*/
public function publish(array $prm = array()) {
if (!$this->cfg->viewAction)
return null;
$this->preFetch();
return $this->tpl->fetch(array_merge(array(
'callback'=>array($this, 'callbackTpl'),
'callbackPrm'=>$this->prmExec['callbackPrm'],
), $prm));
}