I don't think CI_Controller is loaded yet. The Exception class is handling the 404 page output using an include
.
In the old days, I used to use straight include
s to piece together a template, or do a file_get_contents()
or cURL request to my 404 page URL, but they finally did something about it. In 2.0 you can define a custom 404 page in routes.php
:
$route['404_override'] = 'controller/method/parameter';
It's still not a perfect solution, but the easiest way now is just to use the route.
Note that base_url()."controller/method/parameter"
must be a valid url, and you should make sure to set a 404 header in the controller that outputs the page too (it's not done automatically for some reason).