Welcome Guest, Not a member yet? Register   Sign In
about header and footer
#3

[eluser]Michael Wales[/eluser]
Your header, footer, etc. should all be views. HTML goes in views. Your controller will then call all of these views in the correct order or a master layout view that then calls these views (my preferred method - explain in code below).

controllers/posts.php
Code:
function index() {
  // Load a few posts from our blog
  $data['posts'] = $this->post->get_recent(10);

  // Our partial view to load
  $data['partial'] = 'posts/index';

  // Load our master view file
  $this->load->view('layout', $data);
}

views/layout.php
Code:
<?php
  $this->load->view('header');
  $this->load->view($partial);
  $this->load->view('footer');


Messages In This Thread
about header and footer - by El Forum - 10-23-2009, 04:17 AM
about header and footer - by El Forum - 10-23-2009, 05:56 AM
about header and footer - by El Forum - 10-23-2009, 06:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB