Welcome Guest, Not a member yet? Register   Sign In
How to insert view into another view?
#9

(12-10-2015, 03:13 AM)nasser.man Wrote: you can get output of view using this command:
$output_of_view1 = $this->load->view('path_to_view1" , $data , true);

then in view2 , you can echo $output_of_view1, remember to send $output_of_view1 to view2,

$data['view1'] = $output_of_view1;
$this->load->view('path_to_main_view' , $data );

i hope this helps,

Yes, the third parameter of Load::view() is the answer. I don't see any reason to use anything else. Most websites are going to have a main template, which pages that are generated as content inserted into the main template. Setting the third parameter of view() to TRUE ensures that the view is not output, but returned.
Reply


Messages In This Thread
How to insert view into another view? - by Kostia - 12-10-2015, 01:27 AM
RE: How to insert view into another view? - by skunkbad - 12-17-2015, 03:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB