How to get path of view file in codeigniter
I'm not sure if this is a proper way but you can try this, just create a helper file i.e. my_helper.php
in your application/helper
folder and paste following function in this helper file
function get_view_path($view_name){ $target_file=APPPATH.'views/'.$view_name.'.php'; if(file_exists($target_file)) return $target_file;}
To 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
$this->load->helper('my_helper');$path_to_view = get_view_path('welcome'); // Will return the path if welcome.php exists in the view folder.
You can auto load it using config.php's $autoload['helper'] = array('functions_helper');