• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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/';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.