From 23174a64277cad04c89d943fa65694299f7424d6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 15 Dec 2010 15:18:16 +0000 Subject: ['404_override'] can now take methods and URI segments, not just a controller name. This is useful for 404 pages on errors/page_missing or /pages/view/404. --- system/core/Router.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'system/core/Router.php') diff --git a/system/core/Router.php b/system/core/Router.php index 9276800c3..79a8b4fcc 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -270,19 +270,17 @@ class CI_Router { // If we've gotten this far it means that the URI does not correlate to a valid // controller class. We will now see if there is an override - if (isset($this->routes['404_override']) AND $this->routes['404_override'] != '') + if (!empty($this->routes['404_override'])) { - if (strpos($this->routes['404_override'], '/') !== FALSE) - { - $x = explode('/', $this->routes['404_override']); + $x = explode('/', $this->routes['404_override']); - $this->set_class($x[0]); - $this->set_method($x[1]); + $this->set_class($x[0]); + $this->set_method(isset($x[1]) ? $x[1] : 'index'); - return $x; - } + return $x; } + // Nothing else to do at this point but show a 404 show_404($segments[0]); } -- cgit v1.2.3-24-g4f1b From c5bf616c68ab4d18777ba77d5eaf07384b392f78 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 30 Jan 2011 21:17:11 -0500 Subject: Added 404_override to Codeigniter file to catch the 404 if the controller is available but no method. Fixes #19 --- system/core/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Router.php') diff --git a/system/core/Router.php b/system/core/Router.php index 7be508fef..6893e6e92 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -270,7 +270,7 @@ class CI_Router { // If we've gotten this far it means that the URI does not correlate to a valid // controller class. We will now see if there is an override - if (!empty($this->routes['404_override'])) + if ( ! empty($this->routes['404_override'])) { $x = explode('/', $this->routes['404_override']); -- cgit v1.2.3-24-g4f1b