Repeating, my own function, how? |
[eluser]Gewa[/eluser]
Hi, I am making a web-site , and I liked so much CI. Thank you guys for this excellent tool Please advice such thing. In each controller, in constructor place I am putting such code Code: class Content extends Controller { Which displays Header, Left Peace of web-site with left menu.... Can you tell me the way, how can I make header() function or something like $this->bla-bla->header() that can i put once, instead of this huge code each time? Where to create this function, and where to put... thanks
[eluser]Pascal Kriete[/eluser]
You would could create a library. Code: class Layout { Name that file layout.php and plop it in your application/libraries folder. To use, autoload 'layout' and in your constructors do: Code: $this->layout->show_header(); Obviously you can add functions as your heart desires. Here's some complimentary reading. Hope that helps.
|
Welcome Guest, Not a member yet? Register Sign In |