• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's the practical way to load header and footer

#4
[eluser]Armchair Samurai[/eluser]
The basic one I use for simple sites is to have a template view file which is set up something like this:
Code:
<?php
/* The view file: template.php */

$this->load->view('includes/'.empty($header) ? 'header' : $header);
$this->load->view($content);
$this->load->view('includes/'.empty($footer) ? 'footer' : $footer);

?>
Then just call the content from the controller:
Code:
/* In your a controller function */

$this->load->vars(array(
    'content' => 'myview',
    'var' => 'foo',
    'other_var' => 'bar',
));
$this->load->view('template');


Messages In This Thread
What's the practical way to load header and footer - by El Forum - 06-08-2008, 09:04 PM
What's the practical way to load header and footer - by El Forum - 06-08-2008, 09:25 PM
What's the practical way to load header and footer - by El Forum - 06-08-2008, 09:47 PM
What's the practical way to load header and footer - by El Forum - 06-08-2008, 09:48 PM
What's the practical way to load header and footer - by El Forum - 06-08-2008, 10:13 PM
What's the practical way to load header and footer - by El Forum - 06-09-2008, 12:57 AM
What's the practical way to load header and footer - by El Forum - 06-09-2008, 01:08 AM
What's the practical way to load header and footer - by El Forum - 06-09-2008, 10:29 AM
What's the practical way to load header and footer - by El Forum - 06-09-2008, 12:16 PM
What's the practical way to load header and footer - by El Forum - 06-22-2008, 05:34 PM
What's the practical way to load header and footer - by El Forum - 06-22-2008, 05:53 PM
What's the practical way to load header and footer - by El Forum - 06-22-2008, 05:56 PM
What's the practical way to load header and footer - by El Forum - 06-23-2008, 09:29 AM
What's the practical way to load header and footer - by El Forum - 06-23-2008, 10:44 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.