本文整理匯總了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;
}