[eluser]Jelmer[/eluser]
@Ripe
I've done that by adding the following to the main routes.php config file:
Code:
// Check if first segment corresponds to a module
$segment = substr(load_class('URI')->_parse_request_uri(), 1);
$segment = str_replace(load_class('Config')->item('url_suffix'), '', $segment);
$segment = array_shift(explode('/', $segment));
if ( ! empty($segment) && is_dir(APPPATH.'modules/'.$segment))
$route[$segment.'(:any)?'] = $segment.'$1';
Which finds the first segment in the $segment variable and only adds the rule when a module of that name exists. So you still need the "local" routes.php files, but the modules will be drag-and-drop.
This could probably be done in a way that's better from a logical point of view (there shouldn't be any programming in the config files), but this works like a charm and works without having to make any changes to the Modular Seperation libs.
EDIT (4 July 2010): I just updated to CI2.0 and that needs a small change to the code above:
Code:
$segment = substr(load_class('URI', 'core')->_parse_request_uri(), 1);
$segment = str_replace(load_class('Config', 'core')->item('url_suffix'), '', $segment);
$segment = array_shift(explode('/', $segment));
if ( ! empty($segment) && is_dir(APPPATH.'modules/'.$segment))
$route[$segment.'(:any)?'] = $segment.'$1';
The load_class() function needs to know that URI is a core library or it will throw an error.