Welcome Guest, Not a member yet? Register   Sign In
Redirect all URL requests to only one controller
#4

[eluser]pedsa[/eluser]
[quote author="WanWizard" date="1338218328"]Or simply are a route for ":any" that routes to 'front/index', and use the URI class to determine what segments are present and which data to fetch from the database.[/quote]

Thank you.

Here's the solution like you said:

In application/config/routes.php
Code:
$route['default_controller'] = "front_controller";
$route['(:any)'] = $route['default_controller'];

In application/controllers/front_controller.php
Code:
class Front_controller extends CI_Controller {

    public function index() {
$argv = $this->uri->segment_array();
$argc = count($argv);
echo "<br>Number of segments = ".$argc;
echo "<pre>";
print_r($argv);
    }

}

This approach certainly will slow down the page speed, but, in my opinion, it will increase the application flexibility. Do you know any other more effective way to handle this approach in CodeIgniter?


Messages In This Thread
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 05:26 AM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 07:56 AM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 08:18 AM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 11:20 AM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 01:35 PM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 04:41 PM
Redirect all URL requests to only one controller - by El Forum - 05-28-2012, 08:05 PM
Redirect all URL requests to only one controller - by El Forum - 05-29-2012, 11:24 AM
Redirect all URL requests to only one controller - by El Forum - 05-29-2012, 01:25 PM
Redirect all URL requests to only one controller - by El Forum - 05-30-2012, 03:20 AM
Redirect all URL requests to only one controller - by El Forum - 05-30-2012, 03:59 AM
Redirect all URL requests to only one controller - by El Forum - 05-30-2012, 04:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB