Welcome Guest, Not a member yet? Register   Sign In
Is that possible to load a view which is not in views folder
#1

[eluser]datactrl[/eluser]
HI, all

I have some very general view files can be used by different application. I would like to save it in a special folder for different applications to load. With $this->load->view(), it seems not possible. However, is there a work arround to do it? Thank you!


Jack
#2

[eluser]Colin Williams[/eluser]
I would have your views folder, or a sub-folder symlink to the other folder.
#3

[eluser]marcoss[/eluser]
Or use php include.
#4

[eluser]xwero[/eluser]
You can make a view directory in the system directory and do something like
Code:
$this->load->_view_path = BASEPATH.'views/';
$this->load->view('general_view');
$this->load->_view_path = APPPATH.'views/'; // reset class variable for other views
You could extend the loader class with a method to cut down the code in your controller.
#5

[eluser]Phil Sturgeon[/eluser]
The paths can be relative too.

Code:
$this->load->_view_path = '../wherever/views/';




Theme © iAndrew 2016 - Forum software by © MyBB