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


PHP response::getProxy方法代码示例

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


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

示例1: fetch

	/**
	 * Fetch the template
	 *
	 * @param array $prm Array parameter for retrieve the tpl file (exemple: used to force the tpl extension via tplExt)
	 * return string The result fetched
	 * @see file::nyroExists
	 */
	public function fetch(array $prm=array()) {
		$content = null;
		$cachedContent = false;
		$cachedLayout = false;

		$oldProxy = response::getProxy();
		response::setProxy($this->responseProxy);

		$cacheResp = null;

		if ($this->cfg->cache['auto']) {
			$cache = cache::getInstance(array_merge(array('serialize'=>false), $this->cfg->cache));
			$cache->get($content, array(
				'id'=>$this->cfg->module.'-'.$this->cfg->action.'-'.str_replace(':', '..', $this->cfg->param)
			));
			$cacheResp = cache::getInstance($this->cfg->cache);
			$cacheResp->get($callResp, array(
				'id'=>$this->cfg->module.'-'.$this->cfg->action.'-'.str_replace(':', '..', $this->cfg->param).'-callResp'
			));
			if (!empty($content)) {
				$cachedContent = true;
				$cachedLayout = $this->cfg->cache['layout'];
				if (!empty($callResp)) {
					$this->responseProxy->doCalls($callResp);
					$this->responseProxy->initCall();
				}
			}
		}

		if (!$cachedContent) {
			// Nothing was cached
			$action = $this->cfg->action;
			if (array_key_exists('callback', $prm))
				$action = call_user_func($prm['callback'], $prm['callbackPrm']);
			$file = $this->findTpl($prm, array(
				'module_'.$this->cfg->module.'_view_'.$action,
				'module_'.$this->cfg->defaultModule.'_view_'.$this->cfg->default
			));

			if (file::exists($file))
				$content = $this->_fetch($file);
		}

		if ($this->cfg->layout && !$cachedLayout) {
			// Action layout
			$file = $this->findTpl($prm, array(
				'module_'.$this->cfg->module.'_view_'.$this->cfg->action.'Layout',
				'module_'.$this->cfg->module.'_view_layout'
			));
			if (file::exists($file)) {
				$this->content = $content;
				$content = $this->_fetch($file);
			}
			if ($this->cfg->cache['auto'] && $this->cfg->cache['layout'])
				$cache->save();
		}

		if ($cacheResp && $this->responseProxy->hasCall()) {
			$callResp = $this->responseProxy->getCall();
			$cacheResp->save();
		}

		response::setProxy($oldProxy);
		return $content;
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:72,代码来源:tpl.class.php


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