CodeIgniter Forums
Place template folder out of application, using HMVC - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Place template folder out of application, using HMVC (/showthread.php?tid=51664)



Place template folder out of application, using HMVC - El Forum - 05-12-2012

[eluser]TomTom[/eluser]
Hi all,

I'm sorry if the question sounds dumb, I'm a total beginner and don't know if this is possible, or if it's a good idea at all. I have a fresh install of Codeigniter and I'm using HMVC with two modules, backend and frontend. I want to create a folder outside of application, in the site root, name it public and host themes and backend-themes folders in it. Like so:
Quote:siteroot
--application
----modules
-------backend
-------frontend
--public
----backend-themes
----themes
--system
Basically, I would like to somehow override the module's views folder and from controllers load a file at 'siteurl/public/themes/themefolder/index.php' as view. Is that possible at all? If it is, what are pros and cons? Thanks in advance.

EDIT: Will this addon help: http://getsparks.org/packages/template/show


Place template folder out of application, using HMVC - El Forum - 05-13-2012

[eluser]jvk22[/eluser]
You need to edit the find() function in application/third_party/MX/Modules.php


Place template folder out of application, using HMVC - El Forum - 05-14-2012

[eluser]TomTom[/eluser]
Thanks for the reply jvk22. I'd just like to know two more things: how do I do it, so that I keep the existing functionality? For example, I still want my application to look for the files in /application/modules/modulename/views and /application/views and only if they don't exist there, look for it in /public/ folder.

Also, is there a way to add a feature to choose different views folders for different modules?