Additional layout layer

Is it possible to add an additional layer for rendering (with events or something else)? I mean not just like a partial but like a layout or the main view with its own $this->getContent(). Now the structure is like this: ```html <main view> <controller layout> <action view> <direct output from controller> </action view> </controller layout> </main view> ``` But I want like this: ```html <main view> <some site's section layout> | <controller layout> | <action view> |\ <direct output from controller> | wrapping controller layout with custom layout </action view> |/ </controller layout> | </some site's section layout> | </main view> ```

I'm interested in a way without cutting the custom layout into head/foot parts...

If you're using Volt. you can leverage Volt Template Inheritance.
Divide it into 3 block, header,middle, footer. somesitesection.volt extends main, and append/prepend some content in the header, middle, footer. controler.volt extends somesitesection and append some content in the header, middle, footer action.volt extends controller and append some content in the header, middle, footer



82.7k

You can use $this->setTemplateBefore('some-template') or $this->setTemplateAfter('some-template') to load a new template before/after the controller layout and the main layout: http://docs.phalconphp.com/en/latest/reference/views.html#using-templates



20.7k

Ou... How can I miss that setTemplateBefore does exactly what I want =) Thanks!