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.

how to set the main views directory?

I want to only change the main views directory,but I don't find the function like 'setMainDir'. how to set the main views directory?thanks.



472
edited Apr '15

sorry,I have just read the source code, found can't do that



12.3k
Accepted
answer
edited Apr '15

you can set the main view, the default layout, layouts dir and partial dir

    $view->setLayoutsDir('/path/to/layouts/');
    $view->setPartialsDir( '/path/to/partials/');
    $view->setMainView('/path/to/default/view'); // notice the missing trailing slash
    $view->setLayout('defaultLayoutName');

If absolute paths don't work, try relative ones. Absolute paths might not work when your path is outside the module.