2009年3月18日星期三

[fw-mvc] Modules and Routing

Hi,

I want to use modules, but I've got troubles with the routes.

I want to have the following routes:

http://host/custom_name
http://host/language/custom_name
http://host/language/module/custom_name
http://host/language/module/controller/custom_name
http://host/language/module/controller/action/custom_name

I don't want to add GET-Parameters for language an custom_name, so I can't
use the default route.


I tried to add the routes this way:

...
$route1 = new Zend_Controller_Router_Route(':customName', $defaults);
$route2 = new Zend_Controller_Router_Route(':language/:customName',
$defaults);
...
$router->addRoute('default', $route1);
$router->addRoute('route2', $route2);
...

But this didn't work as desired.
Because if I include this five routes and I call the page for example
without the action, I get the error that the action does not exist. (I
wanted to use the route: http://host/language/module/controller/custom_name
but the application called the route:
http://host/language/module/controller/action/custom_name)

Also I'd like to add a suffix to the custom_name (for example '.html'). It
would be nice to add the route like this: ':customName.:suffix', but till
now I have to split the custom_name manually.

How can I solve my problem?

--
View this message in context: http://www.nabble.com/Modules-and-Routing-tp22574143p22574143.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: