Routes on zend modules
I want to make a kind of alias for my modules: Is there a way to make
- http://www.example.com/news point to /modules/news/controller/news/->action index.
- And if i go to http://www.example.com/news/show it automaticly points to /modules/news/c开发者_如何学编程ontroller/news/ -> action show
Or do I have to make a route for every single action I make in this module? If I don't make a route my links will look like:
http://www.example.com/news/news/show and http://www.example.com/news/news/show.
P.s i'm using Zend 1.10.6
Thanx in advance!
I guess it will be something like that:
$route = new Zend_Controller_Router_Route(
'news',
array('module' => 'news', 'controller' => 'news', 'action' => 'index'));
$router->addRoute('news', $route);
where first arg 'news' for Zend_Controller_Router_Route is the url http://www.example.com/news that will route to http://www.example.com/news/news/index
salu2
In your config file you must enable modules by putting this in your config file
resources.modules[] =
And it should by default route correctly in your application.
You will have to define a route for each URL you want routed in a non-standard way.
精彩评论