Tutorialsplane

Codeigniter Load View in Helper


Codeigniter Load View in Helper – It is very simple to load views in helper you can use ci instance to load the view file in helper function. Here in this tutorial we are going to explain how you can load the view file in helper function.


Codeigniter Load View in Helper

We have crated a custom function in helper file and we want to load views using the codeigniter ci instance.

Codeigniter Load View in Helper Example:

function renderView($viewName)
{
		$CI = &get_instance();
		$CI->load->view($viewName);		
	
}

The above function first gets the instance in $CI variable and then it uses the load view method to load the view file. The above example will work same as the loading views in codeigniter controller function.