[eluser]Pascal Kriete[/eluser]
[quote author="Michael Wales" date="1200715586"]Nice!
For all who want to get a header/footer on your pages very easily - without retyping this within every controller - just extend the Controller class with a constructor/destructor.
Code example (not tested, but should work if my thinking is correct), ghetto-fied for PHP4 support:
/application/libraries/MY_Controller.php
Code:
class Public_Controller {
function Public_Controller() {
parent::Controller();
register_shutdown_function(array(&$this, "shutdown"));
$this->load->view('header');
}
// Ghetto destructor for PHP4 support
function shutdown() {
$this->load->view('footer');
}
}
[/quote]
Looks very nice, but doesn't quite work for me. Well for one, you forgot to extend the Controller. But even then the shutdown function gets called (what does the & in front of the $this do?), but it doesn't actually load the view.