• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with 404_override

[quote author="SneakyDave" date="1308937036"]and it doesn't look like you can manually load it either.[/quote]

Of course! Because all of autoload libraries ALREADY loaded and CI routines prevent it from double-loading. Loaded, but "disconnected" from new 404 controller. My code above - fixes it.

I agree with you - 404_override option is buggy and requires revision.

Thanks MILL, I just saw your suggestion for the change to assign_libraries, and I'm going to try it with the client that insists 404 errors are redirected to the home page. Is that just to get the models to work, or does it work with libraries too?

My code NOT for assign_libraries (I just steal it from there Smile).
It is replacement for 2 lines in CodeIgniter.php file (ver 2.0.2). Yes, I know this is not a good practice but great Quick&Dirty; solution Smile

And YES, as far as all libraries and models in autoload are loads and assigns "byref" to controller's field - they all will be "reassigned" to new controller.

[quote author="SneakyDave" date="1308937036"]I don't disagree with you. My point is that the override feature was added for people to use. [/quote]
Well, i will say it like this : "the override feature was added for people to use (with they own risk!)".

FYI, all HTTP code have its own meaning. I mean, the "real programatic mean". I disagre with other approach, that "anti-pattern" to that. Some websites report a "not found" error by returning a standard web page with a "200 OK" (this is known as a soft 404) are problematic for automated methods of discovering whether a link is broken. Also, if you are building some REST web service, in some situation, that could be a real PITA.

But it your choice after all, so take it at your own risk.

Who says "I returns 200"?
My 404 page goes with correct 404 status.

this is my code from some library:
public function show_missing_page ($pageData)
    $pageData['page_content'] = $this->CI->load->view('common/missing', $pageData, true);

Yes I agree with you. i also had the same problem. thanks for sharing.


St Petersburg chiropractor

I also think that a 404 page can sometimes be a "rich" page, but in any case the possibility should exist in CI so the decision is up to us developers.

This problem only occurs when a non-existing function of an existing controller, which is not the default controller, is called. MILLs solution works, but I'd like to see this different so an ugly hack isn't required anymore.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.