我有一个前端控制器插件。
它适用于 dispatcherloodstartup 方法,但 postdispatcher 不能调用动作!
怎么了?
这是我的插件:
class Places_Controller_Plugin_ActionSetup extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup( Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
$actionStack = new Zend_Controller_Plugin_ActionStack();
$front->registerPlugin($actionStack, 97);
} else {
$actionStack = $front->getPlugin('Zend_Controller_Plugin_ActionStack');
}
$menuAction = clone($request);
$menuAction->setActionName('menu')->setControllerName('index');
$actionStack->pushStack($menuAction);
}
public function postDispatch(Zend_Controller_Request_Abstract $request)
{ $menuAction = clone($request);
$menuAction->setActionName('toolbar')->setControllerName('index');
}
}
这是我的引导代码:
$frontController->registerPlugin(new Places_Controller_Plugin_ActionSetup(), 98);
如果我必须使用stackpush,哪个数字有用?