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

setViewsDir multiple folders


I am trying to setup multiple folders for views. I manage to make it happend by doing this:

        $this->view->setViewsDir(array('folder', 'subFolder'));

However, when i then use setMainView it generates twice?

edited Feb '19

you can define the views directory inside the function onConstruct() on each controller

    public function onConstruct()
        $this->view->setViewsDir($this->config->get('paths')->get("app") . DS .'Views/subdirectory');