Welcome Guest, Not a member yet? Register   Sign In
show_404
#1

[eluser]Lima[/eluser]
Is that possible to call function on controller when function show_404 is called.
or reroute to controller when function show_404 is called.

I have tried to modify application/errors/error_404.php but I got error
Quote:Fatal error: Call to undefined function: get_instance()

Any idea?
#2

[eluser]n0xie[/eluser]
[quote author="Lima" date="1253793717"]Is that possible to call function on controller when function show_404 is called.
or reroute to controller when function show_404 is called.

I have tried to modify application/errors/error_404.php but I got error
Quote:Fatal error: Call to undefined function: get_instance()

Any idea?[/quote]
You could extend the router class with MY_Router and then override the behaviour of the standard routing practice.


For example take a look at the function _validate_request.

It checks if there is a controller present with the name of the url segment. It does some checking and if it can't find a controller, it sends calls the function show_404. So if you edit this to call 'yourspecific 404 controller', it should do what you want:

Code:
// MY_Router.php

function _validate_request($segments)
{
    // copy the whole function here
    // just change this part:

    $segments = array('<name of the controller>', '<name of the function>');
    return($segments);
    // show_404($segemnts[0]);
}




Theme © iAndrew 2016 - Forum software by © MyBB