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