We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to Define a Default Layout for All controllers

In my project I would like to divide the initial page into 4 parts -HEADER -SIDEBAR -CONTENT -FOOTER

and this be the base template of the whole issue.

In the part of CONTENT I would just like to load the forms that are in the other views.



85.5k
Accepted
answer

$this->di->set('view', function () use ($config) {

            $view = new View();

            $view->setTemplateAfter('main')
                ->setLayoutsDir($config->layoutDir)
                ->setPartialsDir($config->particialDir);

...

you can check some examples here

https://github.com/phalcon/mvc

and i am not 100% sure but i think vokuro uses it as well https://github.com/phalcon/vokuro

this is for single module, if you need multi module, let me know