Setting up a multi module app with a common main layout


I'm having some problems while trying to setup a multi module app with a common main layout.

Imagine I've three modules: backend, module1 and module2. I want to be able to use a common main layout for module1 and module2 and a specific layout for the backend module.

For each module1 and module2, in Module.php I register the view component like this:

$di->set('view', function() {
    $view = new \Phalcon\Mvc\View();
    return $view;

Now, how should folders and files be organized on the '../app/layouts' folder? The module1 and module2 controllers are not loading any views nor layouts from the layouts folder.

Can you help me solving this? Thank you.


Hi Hugo, this is a sample skeleton for a multi-module application with a common layout:

Thank you very much! It worked as a charm! :)