0
我发现此代码here,同时试图了解什么是动作堆,以及为什么它们应该如此糟糕。我认为动作堆只是一种动作助手(就像flashmessenger或重定向器或ViewRenderer一样)。如何在没有操作步骤的情况下做到这一点
但无论如何,有没有人明白这段代码的作用以及如何在没有动作堆的情况下做同样的事情?
class MyController_Action extends Zend_Controller_Action {
function init() {
/** you might not want to add to the stack if it's a XmlHttpRequest */
if(!$this->getRequest()->isXmlHttpRequest()) {
$this->_helper->actionStack('left', 'somecontroller', 'somemodule');
$this->_helper->actionStack('center', 'somecontroller', 'somemodule');
$this->_helper->actionStack('right', 'somecontroller', 'somemodule');
}
}
class MyController extends MyController_Action {
function indexAction() {
// do something
}
}
class SomecontrollerController extends MyController_Action {
function leftAction() {
// do something
$this->_helper->viewRenderer->setResponseSegment('left_container');
}
function centerAction() {
// do something
$this->_helper->viewRenderer->setResponseSegment('center_container');
}
function rightAction() {
// do something
$this->_helper->viewRenderer->setResponseSegment('right_container');
}
}
另一篇关于项目负责人实用ZF的文章 – 2010-10-18 16:46:34