2010-08-18 118 views
1

我想使用Zend_Cache_Frontend_Output緩存我的頁面的某些部分,我有緩存工作,但無法讓視圖助手渲染到緩存中(緩存條目有數據但沒有視圖渲染)。這裏是我的代碼,但有人可以告訴我正確的方法:Zend Framework:緩存渲染

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 { 

    } 

回答

1

難道你要render()方法調用就是缺少一個echo

echo $this->view->render($this->_helper->viewRenderer());