Frankie O'Rourke
Frankie O'Rourke

Reputation: 103

Zend framework - module based system architecture

Be easy on me... I'm brand new to the Zend framework!

Im trying to figure out the best way to create a CMS using Zend which is extendable with modules. These are modules for the CMS not necessarily a module for Zend. For example, there could be an event registration module, photo gallery module, etc. I want each module to define its own URIs instead of in an _initRoutes() in bootstrap.php. This allows each module to be an independent unit like they are in any CMS. The thought is that there could be a hook in a module's main controller defining URI info which is then cached in the database and used by the router.

A few specific questions:

  1. Should the front controller route requests to a module 'front controller' / main controller which routes the request to a specific controller/action within the module? Basically, each module has its own front controller responsible for routing requests to controllers/actions. Is there a better structure for doing this?
  2. Is there a better way than using a hook for a module to define URIs?

Again, I'm new to Zend and just trying to figure out the basics. Any input is greatly appreciated!

Upvotes: 0

Views: 353

Answers (1)

Tim Fountain
Tim Fountain

Reputation: 33148

Should the front controller route requests to a module 'front controller' / main controller which routes the request to a specific controller/action within the module?

No, you should only ever have one front controller.

Is there a better way than using a hook for a module to define URIs?

If you make each module a ZF module, you can create module-specific bootstrap classes. In each module bootstrap class you can then add an _initRoutes() method which defines the routes for that module alone.

Upvotes: 1

Related Questions