Skip to content

Commit 96154e7

Browse files
committed
✨ add route_view helper function
Signed-off-by: otengkwame <[email protected]>
1 parent 899bc40 commit 96154e7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Core/helpers/ci_core_helper.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,27 @@ function route_to($uri = '')
449449
}
450450
}
451451

452+
if ( ! function_exists('route_view'))
453+
{
454+
/**
455+
* Return a view using
456+
* view names from routes
457+
*
458+
* @param string $view The view name
459+
* @return string
460+
*/
461+
function route_view($view = '')
462+
{
463+
$path = trim(server('REQUEST_URI'), '/');
464+
465+
if (strpos($path, '/') !== false) {
466+
$view = $path;
467+
}
468+
469+
return $view;
470+
}
471+
}
472+
452473
if ( ! function_exists('current_route'))
453474
{
454475
/**

0 commit comments

Comments
 (0)