CodeIgniter Forums
Custom 404 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Custom 404 (/showthread.php?tid=52412)



Custom 404 - El Forum - 06-09-2012

[eluser]Zulkifli Said[/eluser]
hi, i try to use custom 404 page from this tutorial http://maestric.com/doc/php/codeigniter_404

my controller error.php

Code:
class Error extends Controller{

function error_404()
{
  $CI =& get_instance();
                $CI->output->set_status_header('404');
  echo "error bro";

}
}

when i open link localhost/mading/admin/blablabla , where there is not function blablabla() in controoler admin. the output : "error bro"


i try change line in method error_404() become the code below,

Code:
class Error extends Controller{

function error_404()
{
  
  $CI =& get_instance();
  $CI->output->set_status_header('404');
  $data['title'] = "404 Page Not Found";
  $data['body'] = $CI->load->view('web/404','',true);
  $CI->load->view('web/web_page',$data);
}
}

but, when i open link localhost/mading/admin/blablabla , where there is not function blablabla in controller admin. the output : blank page. the function error_404 not load the view . why the 404 page not load when i open controller admin/blablabla ??


thanks