Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

INVO How to disable layout for a specific controller?

I just want to disable layout from layout/main.volt for some controllers but have no idea, please help



64.1k
Accepted
answer

https://docs.phalconphp.com/en/latest/reference/views.html#control-rendering-levels

public function afterExecuteRoute($dispatcher)
    {
$this->view->setRenderLevel(
    View::LEVEL_LAYOUT
);

}


10.2k
edited Sep '16

Can also specify the layout in the initialize method of the controller.

    public function initialize() {
        $this->view->setTemplateAfter('path/to/layout');
    }


1.1k

Thanks a lot, Zach, Izo :D