Welcome Guest, Not a member yet? Register   Sign In
Database driven routing in CodeIgniter 2.x

I am creating a site that will have a lot of routes that will need to be added to the routes file (800+) - obviously I do not want to manually add these one by one into the routes config file.

Can anyone suggest the best practice to have my routes loaded automatically from the database. Is there a suitable library/helper that will perform this task that works with version 2.x

For instance..

$route['apple'] = 'brands/index';
$route['blackberry'] = 'brands/index';
$route['htc'] = 'brands/index';
$route['samsung'] = 'brands/index';
These are just a few of the brands i'd be adding to the routes - but there are hundreds of these so i'd want to have this loaded from a database rather than manually type these in. Also - would this method have any impact on site performance having them load from the database?

I am using Codeigniter v2.1.3

I would upgrade to the new Codegniter 4, that version of CodeIgniter is out dated and
has lots of security bugs in it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Wouldn't that design also make caching PHP-code with opcache impossible, reducing speed?

Theme © iAndrew 2016 - Forum software by © MyBB