I'm developing an application using the PhalconPHP framework, as my application grows larger and larger my views folder is becoming rather messy.
Currently my views
folder looks like this:
views_layouts
|_index_..
|_blog_..
|_news_..
|_etc_..
Is there any way to move my controller related folder to a seperate folder named pages
so my directory structure looks like this?
views_layouts_index.volt
| |_blog.volt
| |_news.volt
| |_etc.volt
|
|_pages_index_..
|_blog_..
|_news_..
|_etc_..
I was able to fix this myself by editing the ControllerBase
class.
// Change the default views directory to /app/views/pages/
$moduleName = $this->dispatcher->getControllerName(); // Eg: blog
$actionName = $this->dispatcher->getActionName(); // Eg: index
$this->view->pick("pages/$moduleName/$actionName"); // Result: "pages/blog/index"
You can even call pick()
multiple times to override any view in your controllers.