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.

php templating - override ../views/index.phtml method?

Hi,

Is there any way to override the Main Layout ../views/index.phtml for a specific action? I found a way of doing it with: view->setViewsDir('../app/alternativeviews'); and I was wonder if can be achieve in a different way (something like ->setMainLayout('alternativeindex').

Best regards, Razvan



84.0k
Accepted
answer

You can use Phalcon\Mvc\View::setMainView to change the location of that file.

http://docs.phalconphp.com/en/latest/api/Phalcon%5Mvc%5View.html#methods



562

All right! That's very elegant! Thank You very much!

Razvan