Hi I am facing a problem with hooks in Codeigniter.I have written hook for 'post_controller' which call a Controller function and load the template (Layout view template).It works fine for all normal cases. But now i need to make a custom error page.So i am overriding show_404() function.In this function i use the get_instance(); function to get the CI object.Using the CI object i am calling a function to set the layout parameters.Now the problem i am facing is that when i try to load the view in show_404() function of my custom exception class the view is not getting loaded as the post_controller hook is not getting executed.I tried a lot of things but failed. Can anyone please suggest me any way to do this.Or any other way to render custom 404 page.
function show_404($page = ''){ // error page logic
header("HTTP/1.1 404 Not Found");
$heading = "404 Page Not Found";
$message = "The page you requested was not found ";
$CI =& get_instance();
$metadata[AppContants::META_TITLE] = '404 Page Not Found | Door and Window';
$metadata[AppContants::META_KEYWORDS] = '';
$metadata[AppContants::META_DESCRIPTION] = '';
$CI->setMeta($metadata);
$params['LAYOUT_MAINVIEW']='404_page';
$CI->renderView($params);// this is the function in my controller which sets the parameter for my template.Or it would also be very helpful if i can load the view directly as show below.
$CI->load->view('404_page'); // Loading view directly.
}