I am using a sub-controller structure.
[simple-subcontrollers]https://github.com/phalcon/mvc/tree/master/simple-subcontrollers)
In the above sample, the view directory is changed in app/constrollers/admin/ControllerBase.php as follows.
class ControllerBase extends Controller
{
public function afterExecuteRoute()
{
$this->view->setViewsDir($this->view->getViewsDir() . 'admin/');
}
}
However, with this method, I think it is necessary to have main-view( the overall layout as HTML ), partials, and layouts in each views directory. Because it was written in the document as follows.
public setMainView (mixed $viewPath)
Sets default view name. Must be a file without extension in the views directory
I think this is too inefficient, but isn't it common? (By the way, I want to use multiple sub-contollers.)
It may be possible to solve by changing the names of all the controllers, but it seems that it is not a good management to arrange all the different functions in the same hierarchy, and at least the top controller of the divided controller is I think index is appropriate.