index(); return false; } //check if the file exists $file = 'Controllers/' . $url[0] . '.php'; if( file_exists($file) ) { require_once $file; } else { //echo "The file: $file Does not exists. "; header("Location: ".URL."notfound"); exit; } //declare new instance of the controller class $controller = new $url[0]; $controller->loadModel($url[0]); //check if there's an arguement if(isset( $url[2] )) { $controller->{$url[1]}($url[2]); } else { //check if the methods exist if(isset( $url[1] )) { $controller->{$url[1]}(); } else { $controller->index(); } } } } ?>