![]() |
load header with database information - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: load header with database information (/showthread.php?tid=17913) |
load header with database information - El Forum - 04-19-2009 [eluser]sw[/eluser] I have header/footer views which I include in all my content views. ie. header content (changes depending on the controller) footer The problem is that header view needs to be passed information from the database. This forces me to repeat the same steps in every controller to load the header view with that information and then the content. Is there a better way to do it ? Code: ... load header with database information - El Forum - 04-20-2009 [eluser]Dam1an[/eluser] If he header info is constant, you could use one of the partial cacheing libraries which seem to be floating round the forum lately Alternativly, you could have the header queries done in the constructor (I'd recommend making you're own controller and extending that) and have all the header queries in there You can then just pass the info array (which must be a class variable, protected if you're using PHP5+) MY_Controller Code: MY_Controller extends Controller { Someclass Code: class Someclass extends MY_Controller { load header with database information - El Forum - 04-20-2009 [eluser]sw[/eluser] Not constant. Thanks, I'll try that. |