Opinions Wanted: Routing Within Controllers
I am attempting to create an extremely modular cms with zend framework. The goal is to be able to drop modules such as "blog" or "shop" into the modules directory and have them full integrated into the website with no configuration in the rest of the application. In order for this to happen, each module contains its own config files and MVC structure.
I am running into a bit of trouble with routing, though. I do not want to load _all_ module configs on every http request, so I only want to load the config for the particular module I'm attempting to access. I obviously can't just include routing info in each module's config because I can't access that config until I figure out what module I'm suppose to be loading.
The only thing I can come up with is having all modules have a standard routing scheme ("/blog" goes to blog/index/index, "/shop" goes to shop/index/index) and then having the indexAction of the IndexController of each module handling the "routing" within that particular module. It would basically utilize the forward method to direct the request to a different action depending on the URL. This allows for "perfect" modularity, but it basically ignores a large portion of the Zend MVC architecture (routing).
What do you guys think? Is this the only really optimal solution I've got? Is this efficient? Any other suggestions?
|