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

Custom path for layout

Hello everyone. Please tell me how to set the different path for the layout. Now if you specify setViewsDir, layout will be search layout in a subfolder "layouts". I want to ask for an independent path layout, not depending on the location of the folder views.

//Sorry for Google Translate :)

$this->view->setLayoutsDir("/layouts");

https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_View.html

This is not work for me, path will be "view/layouts", when i set path for the view directory - $this->view->setViewsDir('views'), Phalcon automatic search layout in subfolder "layouts"



2.1k
Accepted
answer

layouts is relative from the base view.

You can always do "../../../where your thing is/"

layouts is relative from the base view.

You can always do "../../../where your thing is/"

Thanks, I think have more right solution