Welcome Guest, Not a member yet? Register   Sign In
There's a bug when I try to customized error page, an 404 page
#1

Hi there's,
My case in CI 3.1.11

when I trry to set default 404_override route in config, its work for page when no function show_404() set on my controller.
BUT if I set function show_404() on my controller its will return default error page. I need to direct page if no id found on my site.

weirdly, when I try this :

  1. when I set my error page on ```routes 404 override```, its not work. its always goes to default errors page CI.(views/errors/html/error_404.php).
    (FIX I know how, because I set show_404() on controller, if i set show_404() on my controller its would be set default error , if im not set show_404(), so my error page would shown.)
  2. when I change CI error page with mine, its work. BUT, when i try to put assets from my css, its turn "
    Message: Call to undefined function base_url()".
    then,
  3. When I set
    $ci = new CI_Controller(); $ci =& get_instance(); $ci->load->helper('url');
  4. on that error page, then its will turn another error. which is "
    Unable to locate the specified class: Session.php
SO, for now i set my only show_404() on my helper Big Grin Big Grin 
and delete your show_404() on your Common.php Big Grin Big Grin Heart

this my github : My issues on github
Reply
#2

how about to set 404_override on your common.php show_404 function

if there's not 404_override set on config/route, so it will return your default error page, BUT...
if we set 404_override to our custom error page, its will direct into our page.

maybe, on show_404 function we can set a condition like that.

```
function show_404(){
if($route['404_override']==""){
//return your code of show_404 before;
}else{
return $route["404_override"]
}
}
```

so, we can easily use 404 function after set customize page on config/route.
hopefully be considered
Reply




Theme © iAndrew 2016 - Forum software by © MyBB