CodeIgniter Forums
Header loading twice - 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 loading twice (/showthread.php?tid=6469)



Header loading twice - El Forum - 02-28-2008

[eluser]MrBaseball34[/eluser]
I'm trying to load a view inside my header and the header is getting loaded again in
the view I'm trying to load.

Any ideas?


Header loading twice - El Forum - 02-28-2008

[eluser]Michael Wales[/eluser]
Please paste your code.


Header loading twice - El Forum - 02-28-2008

[eluser]MrBaseball34[/eluser]
It's way too long.

I am loading the header in the index and in the header, I'm trying to load two other views
and the header is being sent again when the first view is being loaded in the header.


Header loading twice - El Forum - 02-28-2008

[eluser]Michael Wales[/eluser]
This is how it should look.

Controller:
Code:
function index() {
  $this->load->view('header');
}

View - Header:
Code:
<html>
  <head>
    <title>Wizard</title>
  </head>
  <body>
    <? $this->load->view('content'); ?>
    <? $this->load->view('sidebar'); ?>
  </body>
</html>

Is yours similar in nature?

BTW: I think the logic is kind of backwards in this example - you should really load a unique template for the method, which would then load the header, footer, sidebars, whatever else. I can foresee a lot of issues using the header as the entry point to the template.