I wanted to ask if there is any way i can get path of my view file in controller. For example
class welcome extends controller{
function __construct(){
parent::__construct();
}
function index(){
$this->load->view('welcome_message');
}
function test(){
$my_variable = $this->load->view('welcome_message','',TRUE);
}
function another_test(){
/// $path_to_view = ???;
/// echo $path_to_view;
}
}
i want to ask if there is any helper function to get this. The test method has variable containing the html contents in it. But i want to get path of view file???
I’m not sure if this is a proper way but you can try this, just create a helper file i.e.
my_helper.phpin yourapplication/helperfolder and paste following function in this helper fileTo use it you have to load the helper file first and then call the function with the name of the view as the function’s argument
You can auto load it using config.php’s
$autoload['helper'] = array('functions_helper');