[eluser]Jay Turley[/eluser]
[quote author="Peter74" date="1202348848"]questions:
how a make the structure for avoid create a entire page from zero.
[/quote]
With the 1.6 release of CodeIgniter, multiple views may be loaded by the controller, and they will be appended to the output in the order in which they are loaded.
For example, if I want to have a common header and a common footer for every page in my site, I might create three views: header_view.php, footer_view.php, and content_view.php
Then, in my controllers, I would have the following (in this example, I use the "foo" controller):
Code:
<?php
class Foo extends Controller {
function index()
{
$data['page_title'] = 'Blah!';
$data['page_content'] = "blah blah blah";
$this->load->view('header');
$this->load->view('content', $data);
$this->load->view('footer');
}
}
?>
The foo controller will load the header, then append the content (which will use the data passed to it), and then append the footer.
There are other ways to accomplish this. One way might be to load your header and footer into the $data which you pass to the main view (i.e. $data['header']=yourHeaderHere
, and then in your main view you could simply
Code:
<?php echo $header ?>
I hope that helps; I'm still very new to CI myself.