> For me it's common practice to have a controller per 
> "subject". For instance, a NewsController, BlogController, 
> FooController, etc, etc...
> 
> A controller processes and responds to events (typically user 
> actions), and these "processes" vary for each subject/module 
> pair, you usually end up having the same controller in each 
> module, but with different business logic.
> 
> website/NewsController.php
> admin/NewsController.php
> super-admin/NewsController.php
> super-duper-admin/NewsController.php
> 
> Where "website", "admin", "super-admin", "super-duper-admin", 
> are the so called "modules", which are actually just folders....
> 
> I hope this makes a little sense?

Yes, makes total sense. Though I think you're assuming a module is a type of
access in your case. In the way I'm thinking of modules is for completely
separate applications. Can I clarify, what do people consider a 'module' is?
A separate application based on the same framework, or something else?

The initial issue was that under normal ZF working the controller has all
the business logic, and where you have functions like admininstration that
can get very bloated very quickly. Hence why I like to sub-folder the
controller folder into 'sections'

A requirement for me is to have modular apps in totally separate folders to
aid maintenance and updating. 

For example one apps with the admin controllers Items and Reporting may
exist in the same 'admin' module folder under one interpretation of the
module structure. Ie:

app/controllers/admin/reporting.php
app/controllers/admin/items.php

If a second modular app also has a reporting admin function where does it
go? app/controllers/admin/module2-reporting.php gets messy obviously.

That's why I like the idea of the currently documented modular structure
which would allow for:

app/module-1/controllers/admin/reporting.php
app/module-2/controllers/admin/reporting.php

This is similar to the approach Jeremy described earlier. I've added a
second depth of controller files here for organisation.

Unfortunately my discussion is a little circular, since the obvious question
is what would the URL be for the end user? For public front-end stuff it
seems pretty straightforward since different modules would likely be in
separate document root folders, however it's nicer to keep admin stuff in
one root folder (i.e. '/admin/').

Presumably custom routes could be set up to point admin URLs (i.e.
/admin/module-1/reporting/view) to the correct controller.

I think this modular folder structure stuff can get quite complex when
trying to truly keep things separate and easily interchangeable. I'll keep
trying things out..

best wishes,
Simon

Reply via email to