Welcome Guest, Not a member yet? Register   Sign In
Better 404 catching
#9

[eluser]duellsy[/eluser]
For what it's worth, this is my full third_party/MX/Controller.php file contents...
Code:
class MX_Controller
{
    public $autoload = array();
    
    public function __construct()
    {
        $class = str_replace(CI::$APP->config->item('controller_suffix'), '', get_class($this));
        log_message('debug', $class." MX_Controller Initialized");    
        
        /* copy a loader instance and initialize */
        $this->load = clone load_class('Loader');
        $this->load->_init();    
        
        /* autoload module items */
        $this->load->_autoloader($this->autoload);
    }
    
    public function __get($class) {
        return CI::$APP->$class;
    }
    
    
    function _remap($method) {
        if (in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
            $uri = $this->uri->segment_array();
            unset($uri[1]);
            unset($uri[2]);
            
            call_user_func_array(array($this, $method), $uri);
        }
        else {
            redirect('404');
        }
    }
}


and the route:

Code:
$route['default_controller'] = "welcome";
$route['404_override'] = 'errors/show404';
$route['404'] = 'errors/show404';


Messages In This Thread
Better 404 catching - by El Forum - 02-16-2011, 07:36 PM
Better 404 catching - by El Forum - 02-16-2011, 08:12 PM
Better 404 catching - by El Forum - 02-16-2011, 11:41 PM
Better 404 catching - by El Forum - 02-16-2011, 11:48 PM
Better 404 catching - by El Forum - 02-17-2011, 04:33 AM
Better 404 catching - by El Forum - 02-17-2011, 10:43 AM
Better 404 catching - by El Forum - 02-17-2011, 08:41 PM
Better 404 catching - by El Forum - 02-17-2011, 09:36 PM
Better 404 catching - by El Forum - 02-18-2011, 05:35 AM
Better 404 catching - by El Forum - 02-18-2011, 06:56 AM
Better 404 catching - by El Forum - 02-19-2011, 03:47 AM
Better 404 catching - by El Forum - 02-20-2011, 01:08 AM
Better 404 catching - by El Forum - 02-20-2011, 02:00 AM
Better 404 catching - by El Forum - 02-20-2011, 02:10 AM
Better 404 catching - by El Forum - 02-21-2011, 04:23 PM
Better 404 catching - by El Forum - 02-21-2011, 06:19 PM
Better 404 catching - by El Forum - 02-21-2011, 07:09 PM
Better 404 catching - by El Forum - 02-22-2011, 03:20 AM
Better 404 catching - by El Forum - 02-22-2011, 04:38 AM
Better 404 catching - by El Forum - 02-22-2011, 11:05 AM
Better 404 catching - by El Forum - 02-24-2011, 04:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB