我想延长控制器,所以我的IndexController看起来像正确的方式来扩展控制器的Zend
class IndexController extends Zend_Controller_Action
{
public function IndexAction()
{
//Add a few css files
//Add a few js files
}
public function LoginAction()
{
//Login stuff
}
}
现在,当我尝试这样做:
require_once("IndexController.php");
class DerivedController extends IndexController
{
public function IndexAction()
{
//Override index stuff, and use the dervied/index.phtml
}
}
并调用derived/login
我得到
`Fatal error: Uncaught exception 'Zend_View_Exception' \
with message 'script 'derived/login.phtml' not found in path`
所以要解决这个问题,我说哦,好吧,我可以强制登录使用自己的看法。然后我想,这是很容易的所有我的GoTa内IndexController::LoginAction
做的就是添加:
$this->view->render('index/login.phtml');
,但它仍然试图寻找derived/login.phtml
。
只是为了扩大多一点关于这个,我只希望这是在DerivedController
定义为使用derived/<action>.phtml
但一切如LoginAction
使用操作<originalcontroller>/<action>.phtml
我应该做不同的事情呢?或者我错过了一小步?
注意如果我添加derived/login.phtml
或符号链接它从index/login.phtml
它的作品。
对不起,我不想重用所有'* .phtml'文件我想覆盖它们。以及任何未被覆盖以使用其原始控制器'.phtml'文件的动作。 –
好的,你有没有尝试过一个简单的条件?请参阅编辑 – simplyray
但要进行编辑,我必须覆盖每个操作。我不想覆盖 –