Each theme, custom view file


how to setup a view folder which accept custom view file for each theme?

For example I would like to have:

app/views/default/ => all defautl view files

app/views/custom/ => all view file of custom theme


That directory structure will work. The trick is setting up your bootstrap file and your DI to have your View properly register which directory it should be looking in for View files.


@quasipickle yes I was think about similar way, define a variable and setup view path based on this configuration

However, I would like to know if exist a way for do this within framework, something like wordpress child theme http://codex.wordpress.org/Child_Themes which allow you to override just a few view files and not all.

So the view engine check firstly if a view file exist into active theme folder, if not exist, then load default one.

edited Jun '14

Class Phalcon\Mvc\View has a method "exists (unknown $view)", wich is not documented, but method's name doesn't offer many differents meanings.

Maybe, with this method you can test if theme view file exist and if not fallback to default view ...


@phalcon can you please tell me if you can extend phalcon 2.0 for handle this?

@le51 thanks I will try what you suggest, but I think that this feature can be implemented in core template of phalcon.