CodeIgniter Forums
Store view in variable/views within views - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Store view in variable/views within views (/showthread.php?tid=5839)



Store view in variable/views within views - El Forum - 02-05-2008

[eluser]Lockzi[/eluser]
Hello, I'm wondering if something like this would be possible:

Code:
$data['content'] = $this->load->view('skeleton/main_view', $data);

and then in the view go like

Code:
<?=$content?>


This would be extremely useful for ajax update requests because then I can call a function in my controller to just render the information that should change.

Cheers


Store view in variable/views within views - El Forum - 02-05-2008

[eluser]Seppo[/eluser]
I'm not sure if it's what you want, but if the third parameter is true the view is returned and not printed

Code:
$data['content'] = $this->load->view('skeleton/main_view', $data, TRUE);



Store view in variable/views within views - El Forum - 02-05-2008

[eluser]Lockzi[/eluser]
Thanks for clearifying that I'm an idiot...

Kidding Smile


You are my hero, honestly! Atleast for tonight hahahahaaaaa This was exactly what I was looking for.


Store view in variable/views within views - El Forum - 02-15-2011

[eluser]Ziggomat1k[/eluser]
Thanks for this!