By default you have the following URL-syntax in ZF: /module/controller/action. What i want, is to build an menu-system where i can use any URL I want.
Lets say I make an menu-item called ‘news’. When i call http://www.site.com/news i want to have the folowing loaded:
- module: news
- controller: frontpage
- action: display
These config-values must be configured in the database-record for the menu-item.
How can I do this in zend? I spend a lot of time searching for it, but I still can’t figure out how to. Does anybody?
You can create a plugin and in routeStartup define something that intercept your request and route
/module/controller/actionto/action, but for this all your action names must be unique :In myModel define a method can get you an object(or an array) that contains module, controller names (from you DB ).
and register this plugin in your bootstrap: