Query available to all funtions in Controller - 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: Query available to all funtions in Controller (/showthread.php?tid=18505) |
Query available to all funtions in Controller - El Forum - 05-08-2009 [eluser]weetstraw[/eluser] In my footer view I have a foreach loop, because of this, each function that uses this footer requires me to create the array for the loop. Code: 'recent'=>$this->Home_model->getRecent(), Question is...How to I make "recent" available to all functions in the controller without having to add it to each time? Query available to all funtions in Controller - El Forum - 05-08-2009 [eluser]Michael Wales[/eluser] You can create the array that is passed to your view file within the controller's constructor. This will make it available to each method within that class. |