Welcome Guest, Not a member yet? Register   Sign In
Header and Footer
#1

[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
#2

[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.
#3

[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/l...deigniter/

Also eventually your probably need to look at
https://bitbucket.org/wiredesignz/codeig...sions-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.




Theme © iAndrew 2016 - Forum software by © MyBB