CodeIgniter Forums
View problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: View problem (/showthread.php?tid=47138)



View problem - El Forum - 11-28-2011

[eluser]Unknown[/eluser]
I have a controller called 'cart' that's main function is to get the content of a shopping cart and then output it to a view.

$this->load->view('cart', $aData);

This all works fine but the project I developing works by using a library to load all the views and hten assign them to variable (kind of like a template). This means that the view I am loading in my controller is getting overridden with this line.

$aData['shoppingCart'] = $this->load->view('cart', '', true);

Is there a way I can call a constructor from this library and then pass the data into the view frmo the library?

Thanks for any help

By the way I'm not allowed to change the structure of the project