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