Welcome Guest, Not a member yet? Register   Sign In
Best way to load header and footer once globally?
#1

I was wondering what is the best way to load header and footer files globbaly once, in order to pass data from db in the template. For example, urls, meta descriptions and keywords etc. which will be controlled from the db.

I found this while i was searching the internet: https://stackoverflow.com/questions/9540...odeigniter
but i don't know if someone has a better idea.

For now i load the files and pass data as usual in every controller like:

$this->load->view('templates/header', $data);
$this->load->view('pages/[page_name]', $data);
$this->load->view('templates/footer', $data);

etc... etc...

This is fine for small scale sites with one or two controllers. What if i have more?!

Any suggestions on that?

Thanks!

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply


Messages In This Thread
Best way to load header and footer once globally? - by HarrysR - 09-28-2018, 07:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB