I thought it is an easy task to do, but some errors show up as a result of what I did. I wrote two simple pages in the view; 1- header + body 2- footer.
Then I simply added the following code to the controller’s main file:
$this->load->view('footer.php');
$this->load->view('main.php');
And in the main.php (header+body) I added a php line to include the footer like this:
<?php include("footer.php"); ?>
however the error is still showing up…
And the error message is this:
A PHP Error was encountered
Severity: Warning
Message: include(footer.php) [function.include]: failed to open stream: No such file or directory
any idea how to resolve this issue?
All comments are appreciated.
The error is probably because the include in your view should be pointing to the footer.php in your views folder, something like /applications/views/footer.php.
However, including views like that is not the correct way to do it. In your controller you can output multiple views sequentially, so this should be all you need:
Notice the lack of an extension, you only need to pass the name of the file. This will load and render the views one after the other.