CodeIgniter Forums

Full Version: Passing child views an array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[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);

El Forum

[eluser]Unknown[/eluser]
Perfect thanks.