Welcome Guest, Not a member yet? Register   Sign In
Customize location of views
#1

[eluser]mvdg27[/eluser]
Hi,

I'm looking for a way to change the location of the view files. By default they are located in the views folder of the application. But I'd rather position them outside the application. The reason for this is that I run a centrally installed application over different domains. But I want to be able to have different views for each domain. And these views should be easily modified per domain, either through FTP or using a CMS.

I looked at the loader class, and on line 55 it says: $this->_ci_view_path = APPPATH.'views/'; So this should be the variable that I would want to change. Hardcoding is not an option for me, as it changes per domain.

I also saw that in the function $this->load->file() it is possible to change the application path. But this one off course doesn't parse anything.

So right now I'm not sure what to change and how to change it. Preferably I don't edit the CI core files. Can anyone advice me on how to set this up?

Thanks in advance.
Cheers, Michiel
#2

[eluser]xwero[/eluser]
You could extend the controller with you own
Code:
// MY_Controller.php
class Base_Controller extends Controller
{
  
   function Base_Controller()
   {
      parent::Controller();
      $this->load->_ci_view_path = 'custom/view/path/';
   }
}
And each controller you add is a child of the base_controller instead of the regular controller.




Theme © iAndrew 2016 - Forum software by © MyBB