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

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Store view in variable/views within views (/thread-5839.html)



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!