當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tpl::fetch方法代碼示例

本文整理匯總了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;
}
開發者ID:holsinger,項目名稱:openfloor,代碼行數:58,代碼來源:function.include_clipcache.php

示例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));
	}
開發者ID:nyroDev,項目名稱:nyroFwk,代碼行數:14,代碼來源:abstract.class.php


注:本文中的tpl::fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。