Welcome Guest, Not a member yet? Register   Sign In
table object outputting before things that were called prior
#1

[eluser]php_princess[/eluser]
When I run this controller it outputs the table before outputting the header. Why is this?

Code:
class Home extends CI_Controller
{
   public function index()
{
  $logged_in = $this->session->userdata('logged_in'); //inserts true or false into variable
  
  $data['title'] = 'My Site Title Here';
  
  $this->load->view('templates/header', $data);
  $this->load->view('home/index', $data); // loads static content of page
      
  if (!$logged_in) //decides whether to display dynamic content
  {
   $this->load->library('table');
    
     $items= array(
   array('Name', 'Color', 'Size'),
   array('Fred', 'Blue', 'Small'),
   array('Mary', 'Red', 'Large'),
   array('John', 'Purple', 'Medium'),
   );
  
   print $this->table->generate($items);
  }
  
  $this->load->view('templates/footer');
}
}


Messages In This Thread
table object outputting before things that were called prior - by El Forum - 08-23-2012, 08:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB