Welcome Guest, Not a member yet? Register   Sign In
CI beginner question
#1

[eluser]Avril[/eluser]
Hello,

When creating a site with several pages it's simpler to create for example a header and a footer file and then include them into the other pages. This way you don't need to code every change on every page and we all win time.

But I've tried this with CI and it seems not to work for me, I'm referring to this thread that I've started load problem? .

So basically, I have a header.php (where I create my top navigation links) and I include it in for example index.php, the data seems not to load.
But if I load the navigation data in the homepage.php (controller where he pulls the blog posts from my db) then it works. I'm not sure what I'm doing wrong here?

Hope that I was clear enough, I can write bizar english sometimes Big Grin
#2

[eluser]Bas Vermeulen[/eluser]
Hi Avril,

I load a template view from all my controllers and pass a main_view variable to it:

Code:
$data['main_view'] = 'login_form';
$this->load->view('template', $data);

The template view looks like:
Code:
// Load header
$this->load->view('header', $data);
// Load main view
$this->load->view($main_view, $data);
//Load footer
$this->load->view('footer', $data);


You could also use Phil's template library:
click
#3

[eluser]Avril[/eluser]
Cool, it's working. Thanks!
#4

[eluser]Bas Vermeulen[/eluser]
You're welcome Smile




Theme © iAndrew 2016 - Forum software by © MyBB