Hi!
You can do this by defining your own route for example like this:
$router = new Zend_Controller_RewriteRouter();
$router->addRoute(
'default',
new Zend_Controller_Router_Route(':action/:subnavi/', array
('controller' => 'YourDefaultController' , 'action' =>
'YourDefaultAction', 'subnavi' => 'YourDefaultSubnavi'))
);
$front->setRouter($router);
// Instead this 2 lines should be just Zend_Controller_Front::run
(PATH_YOUR_CONTROLLERS), but it's not working.... why?
$front->setControllerDirectory(PATH_YOUR_CONTROLLERS);
$front->dispatch();
Now, when you request this url http://www.example.org/mainnavi/
subnavi you will get:
controller = YourDefaultController
action = mainnavi
subnavi = subnavi
This approach is suitable only for very small sites...
For more information please read this:
http://framework.zend.com/manual/en/
zend.controller.providedsubclasses.html#zend.controller.providedsubclass
es.rewriterouter
On 29.01.2007, at 17:37, Ivan Ruiz Gallego wrote:
Hello,
This is my very simple question:
I would like to route URL's like "http://www.example.org/mainnavi/
subnavi" to a single controller that renders the appropriate
content depending on "mainnavi" and "subnavi". I would like to
avoid writing one controller for each main navigation point. Which
is the appropriate way to do this within Zend Framework? Or do you
think that the whole approach is unappropriate? Thank you.
Regards,
Ivan.