routing tweaks
This commit is contained in:
parent
c895797f48
commit
67fc68c904
@ -263,7 +263,7 @@ function route()
|
||||
unset($custom_routes['default_controller']);
|
||||
unset($custom_routes['404_handler']);
|
||||
|
||||
foreach($custom_routes as $uri => $map)
|
||||
foreach($custom_routes as $uri => &$map)
|
||||
{
|
||||
if (preg_match("`{$uri}`i", $pi))
|
||||
{
|
||||
@ -290,17 +290,25 @@ function route()
|
||||
$num_segments = count($segments);
|
||||
}
|
||||
|
||||
// Determine route based on uri segments
|
||||
if ($num_segments === 1)
|
||||
{
|
||||
$func = $pi;
|
||||
}
|
||||
|
||||
if ($num_segments === 2)
|
||||
elseif ($num_segments === 2)
|
||||
{
|
||||
list($controller, $func) = $segments;
|
||||
list($module, $controller) = $segments;
|
||||
|
||||
// If it's just controller/function
|
||||
if ($controller == 'index')
|
||||
{
|
||||
$controller = $module;
|
||||
$module = $routes['default_module'];
|
||||
$func = 'index';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($num_segments >= 3)
|
||||
elseif ($num_segments >= 3)
|
||||
{
|
||||
list($module, $controller, $func) = $segments;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user