CodeIgniter Forums
Passing child views an array - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Passing child views an array (/thread-33434.html)



Passing child views an array - El Forum - 08-25-2010

[eluser]Unknown[/eluser]
Hi there, newbie here,
I am loading a View in, in that view I'm loading 2 partial views, they require an array each, I can pass either one of them an array, just by passing it to the parent, but not both. What's the best way?
Thanks, Phil


Passing child views an array - El Forum - 08-25-2010

[eluser]danmontgomery[/eluser]
Code:
$data = array(
    'child_view_1' => $this->load->view('child_view_1', $array_1, TRUE),
    'child_view_2' => $this->load->view('child_view_2', $array_2, TRUE)
);
$this->load->view('parent_view', $data);



Passing child views an array - El Forum - 08-25-2010

[eluser]Unknown[/eluser]
Perfect thanks.