I have an "ancient" ZF1 application, which has lot of controllers in the default module. It has also lot of modules. The modules have sometimes own logic inside (logically), but in most of the cases they just add new controllers (module specific), but must also handle the common application functionality.
To be more specific, here is a sample application structure:
<pre>
application
controllers
AController.php
BController.php
CController.php
modules
m1
controllers
M1aController.php
M1bController.php
m2
controllers
M2aController.php
M2bController.php
etc.
</pre>
What I want to achieve is, that if an request to a module comes, asking for a controller from the default module, then this controller to be called.
Example (having in mind the above schema):
http://www.example.com/a/b
- executes the action B from AController.php (standart ZF behavior)
http://www.example.com/m1/m1a/b
- executes the action B from M1aController.php in module m1 (also standart ZF behavious)
http://www.example.com/m1/a/b
- it must execute the action B from AController.php in the default module, regardless of the specified m1 module
So if the called controller is missing in the module, then the controller from the default module must be called.
Furthermore I need a possibility to have different view scripts in the modules for the controllers/actions from the default module.
Extending the sample from above:
<pre>
application
controllers
...
views
scripts
a
b.phtml
c.phtml
...
modules
m1
views
scripts
a
b.phtml
c.phtml
etc.
</pre>
In this case when http://www.example.com/m1/a/b
is called, it must execute the action B from AController.php, but using the b.phtml view script from the module directory, not from the default one.
How can I achieve such functionality?
Thanks in advance!