CodeIgniter Forums
use header, body and footer all the time - 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: use header, body and footer all the time (/showthread.php?tid=26828)



use header, body and footer all the time - El Forum - 01-24-2010

[eluser]max123[/eluser]
I'm using the same header and footer for all the pages in my site. So where can I define it so that I can use it only by echoing a variable in a view file


use header, body and footer all the time - El Forum - 01-24-2010

[eluser]srpurdy[/eluser]
Best way would be to extend the controller class using MY_Controller, pass data from that to your controllers so you use a file like header.php and footer.php as a template. You could also output your data into a small section of your layout by passing data this way as well. You could even go a step further than that and use the database to get the folder information, so you could end up with a real template system Smile

Make sense? I think they're are some good examples of how to do it in the wiki if I remember correctly.


use header, body and footer all the time - El Forum - 01-24-2010

[eluser]pistolPete[/eluser]
Have a look at http://codeigniter.com/wiki/Header_and_footer_and_menu_on_every_page/.


use header, body and footer all the time - El Forum - 01-24-2010

[eluser]Phil Sturgeon[/eluser]
Take a look at my Template library. If you create a MY_Controller this works perfectly. :-)