![]() |
Header code on every controller - 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: Header code on every controller (/showthread.php?tid=14141) |
Header code on every controller - El Forum - 12-19-2008 [eluser]Emanuel01[/eluser] Hello I want to make a structure on my site : header - content - footer . On header i have user auth, clock .. ( php code .. ) My question is : how i put the header on every controller ? ( my header is a controller too.. ) I`ve search on the forum and i`ve find some solutions with wick but i`m not sure if this is right for me . Thx. Header code on every controller - El Forum - 12-19-2008 [eluser]Colin Williams[/eluser] Ah! It's our daily question. Best, most long-term solution would be creating a parent controller or controllers. Search MY_Controller and see the User Guide page on Extending Core Libraries for more information. Header code on every controller - El Forum - 12-19-2008 [eluser]Emanuel01[/eluser] Thx for the fast reply, i`ve find some info about MY_Controller and i think that i`ve understand. ( extend a controller class right ? ) Header code on every controller - El Forum - 12-22-2008 [eluser]Emanuel01[/eluser] OK here is my solution at this problem ( without wick or other library like this .. ) is like Collin says but with more detalis You extend your controller : MY_Controller where you put 2 functions: header and footer then you call this function on your class. You can use templates too ( i use smarty and i include on every page the header and footer template ) Header code on every controller - El Forum - 12-23-2008 [eluser]garrettheel[/eluser] You could use a simple library to load a header and footer around your content. I put one in the Ignited Code section, take a look |