2008年12月8日星期一

[fw-mvc] Router_Route - Routing requests to another controller

I'm having trouble getting a route set up. I've got a modular MVC app up and
running. Inside of my 'forms' module I have a controller with a fairly long
name. The client would like to change what they're seeing in the URL, and
I'd like to avoid refactoring the entire module.

The original request would look something like:

array(
'module' => 'forms',
'controller' => 'really-long-name',
'action' => 'index' // or whatever action that I'm requesting at the
time
);

I've tried setting up a route like the one below:

$route = new Zend_Controller_Router_Route(
':module/shorter-name/:action/*',
array('controller' => 'really-long-name')
);
$router->addRoute('shorter-name', $route);

When I try to use that route (http://example.com/mvc/forms/shorter-name), I
get an "Invalid controller specified (shorter-name)" error.

Is it possible to map routes in this manner?

-----
Jeremy Kendall -- http://www.jeremykendall.net http://www.jeremykendall.net
--
View this message in context: http://www.nabble.com/Router_Route---Routing-requests-to-another-controller-tp20903100p20903100.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: