CodeIgniter Forums
Header and Footer - 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: Header and Footer (/showthread.php?tid=58621)



Header and Footer - El Forum - 06-30-2013

[eluser]Unknown[/eluser]
Hello,

I'm new to CodeIgniter (switched from Kohana) and I'm already in love with it. But what I can't achieve is a simple solution for a global header and footer which is added automatically to any action.

In Kohana I had a self written base controller that extended every other controller with two methods before() (showed header) and after() (showed footer).

I came over a pretty solution with hooks in CodeIgniter, but I can't figure a way out how to pass a var from my action to the hook (for example the page title). My header and footer both have some logic to do (account info, etc).

Thanks for your help.

Max


Header and Footer - El Forum - 06-30-2013

[eluser]xtremer360[/eluser]
I would highly suggest you look on the wiki page of codeigniter and there are plenty of template libraries that are available. Pick the one that best suits your needs. I find Phil Sturgeon's as one of the better ones but there are quite a few.


Header and Footer - El Forum - 07-02-2013

[eluser]Otemu[/eluser]
Old solution I posted awhile ago check it out

Quote:Better yet follow this great tutorial as it shows you how to create master template page which is more or less what your looking for
https://www.ibm.com/developerworks/web/library/wa-codeigniter/

Also eventually your probably need to look at
https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc
Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications.

Hope that helps if you have any more issues with the layout let me know and I send you some example code.