2012-07-23 11 views
1

我有這樣的代碼的Zend控制器不能指定佈局

class PagamentoController extends Zend_Controller_Action 
{ 

    public function init() 
    { 
     /* Initialize action controller here */ 
    } 

    public function indexAction() 
    { 
     $model_pagamenti = new Model_Pagamento(); 
     $this->_helper->layout->setLayout('/crudabstract/index.phtml'); 
     $this->view->render('/crudabstract/index.phtml'); 
    } 
... 

,當我運行/ pagamento /指數

我得到這個錯誤

An error occurred 
Application error 
Exception information: 

Message: script 'pagamento/index.phtml' not found in path (C:/www/www/abc/application/views\scripts/) 
Stack trace: 

爲什麼不會它的工作?它不應該是找「pagamento/index.phtml」,但對於「/crudabstract/index.phtml」

感謝

回答

0

在我自己的代碼中發現瞭如何

$this->_helper->viewRenderer('crudabstract/'.$this->_request->getActionName(), null, true); 
0

錯誤消息指出沒有爲索引操作定義的視圖腳本。當你定義一個控制器時,zend框架會自動尋找一個相應的視圖文件,這個文件在你的案例中沒有找到。所以創建一個相應的視圖文件在

application/views/script/pagamento/index.phtml 

它應該工作。

相關問題