CodeIgniter Forums
how to pass data array into layout at Phil’s template library? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: how to pass data array into layout at Phil’s template library? (/showthread.php?tid=40512)



how to pass data array into layout at Phil’s template library? - El Forum - 04-11-2011

[eluser]Unknown[/eluser]
please advice.

how to pass data array into layout at Phil’s template library?
so far, i just can view the data successfully at the view only, not in layout.
i.e. $this->template->build('home', $data);

but it will get error if we do at layout:
$this->template->set_layout('main', $data);

regards,

hadi


how to pass data array into layout at Phil’s template library? - El Forum - 04-11-2011

[eluser]InsiteFX[/eluser]
Did you red Phil's documentation on the template library?

InsiteFX


how to pass data array into layout at Phil’s template library? - El Forum - 04-11-2011

[eluser]Unknown[/eluser]
sadly, i didn't find yet about this method at phil's documentation.

now, i just do optimization the passing array data from controller to view only not in layout, that need repeated at other views.

regards,

hadi


how to pass data array into layout at Phil’s template library? - El Forum - 04-11-2011

[eluser]InsiteFX[/eluser]
Makes $data global to all views!
Code:
$this->load->vars($data);

$this->load->view('your_view');

CodeIgniter User Guide Loader Class.

InsiteFX