Zend Framework:缓存渲染
问题描述:
I want to use Zend_Cache_Frontend_Output to cache certain sections of my page, I have the cache working but can't get the view helper to render into the cache (the cache entry has data but not the view being rendered). Here's my code but can someone tell me the correct method:
if (!($this->_outputCache->start('page_'.$this->getRequest()->getActionName()))) {
$page = new Default_Model_Pages(array('rewrite'=>Zend_Registry::get('requestedController')));
if (!$page->id()) $this->pageNotFound();
$this->view->headTitle()->prepend($page->windowTitle);
if(file_exists(SITE_PATH.'/skins/'.$siteConf->skin.'/modules/default/index/'.$page->title.'.phtml')) $this->_helper->viewRenderer($page->title);
else $this->_helper->viewRenderer('defaultview');
$this->view->render($this->_helper->viewRenderer());
$this->_outputCache->end();
} else {
}
我想使用 Zend_Cache_Frontend_Output 缓存我页面的某些部分,我有缓存工作但无法获取视图帮助器来渲染 进入缓存(缓存条目有数据,但没有渲染的视图)。 这是我的代码,但有人可以告诉我正确的方法: p>
if(!($ this-> _outputCache-> start('page _'。$ this-> getRequest() - > getActionName()))){
$ page = new Default_Model_Pages(array('rewrite'=> Zend_Registry :: get('requestedController')));
if(!$ page-&gt ; id())$ this-> pageNotFound();
$ this-> view-> headTitle() - > prepend($ page-> windowTitle);
if(file_exists(SITE_PATH。') /skins/'.$siteConf->skin.'/modules/default/index/'.$page->title.'.phtml'))$ this-> _helper-> viewRenderer($ page-&gt ;标题);
其他$ this-> _helper-> viewRenderer('defaultview');
$ this-> view-> render($ this-> _helper-> viewRenderer());
$ this-> _outputCache-> end();
} else {
}
code> pre>
div>
答
Could it be your call to render()
method is just missing an echo
?
echo $this->view->render($this->_helper->viewRenderer());