2009年3月2日星期一

[fw-mvc] Cms-like routing and isDispatched needed.

I created small plugin to push all requests to SectionController::showAction.
This action then decides what data to load and display. Here is the plugin
method:

public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$fc = Zend_Controller_Front::getInstance();

if (!$fc->getDispatcher()->isDispatchable($request)) {
$request->setModuleName('default');
$request->setControllerName('section');
$request->setActionName('show');
$request->setDispatched(true);
}
}

I wonder if this approach is proper. Maybe I should create custom dispatcher
or maybe extend the default one? I also played a bit with routes but I guess
dispatcher or plugin is better place to code such behaviour (I use
dispatcher to check if request is dispatchble and router works before
dispatcher is initalized). Any hints and opinions are greatly appreciated.

Is $request->setDispatched(true) needed in above code?.
--
View this message in context: http://www.nabble.com/Cms-like-routing-and-isDispatched-needed.-tp22294877p22294877.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: