Fixing the issue with breadcrumbs and subfolders; including the link to dashboard by default on all non-dashboard pages.

This commit is contained in:
Topsitemakers 2014-03-17 19:03:43 +01:00
parent 8d06758734
commit af2289206f
2 changed files with 13 additions and 1 deletions

View File

@ -2,6 +2,10 @@
class Utils
{
public static function basePath() {
return substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1);
}
public static function fatalError($message = false, $exception = false)
{
if (!$message)

View File

@ -163,7 +163,15 @@ HTML::macro('image_data', function($imagePath) {
HTML::macro('breadcrumbs', function() {
$str = '<ol class="breadcrumb">';
$crumbs = explode('/', $_SERVER['REQUEST_URI']);
// Get the breadcrumbs by exploding the current path.
$crumbs = explode('/', str_replace(Utils::basePath(), '', $_SERVER['REQUEST_URI']));
// Include the link to Dashboard by default only if the user is not on the
// dashboard page.
if (!Request::is('dashboard')) {
$str .= '<li>' . link_to('dashboard', 'Dashboard') . '</li>';
}
foreach ($crumbs as $key => $val)
{