Fix bug that prevented the active page from being marked in nav

This commit is contained in:
Yorin Anne De Jong 2018-02-13 14:53:33 +01:00
parent 02f54c4458
commit 0d0305cf04

View File

@ -11,10 +11,11 @@ function navbar($depth, $active = NULL) {
'wiki' => 'pvv', 'wiki' => 'pvv',
]; ];
foreach($menuItems as $caption => $link) { foreach($menuItems as $caption => $link) {
$isActive = $active === $link;
if ($caption !== 'webmail') { if ($caption !== 'webmail') {
$link = rtrim(str_repeat('../', $depth) . $link, '/') . '/'; $link = rtrim(str_repeat('../', $depth) . $link, '/') . '/';
} }
$result .= "\t\t<li" . ($active === $link ? ' class="active"' : '') . '>' $result .= "\t\t<li" . ($isActive ? ' class="active"' : '') . '>'
. '<a href="' . $link . '">' . '<a href="' . $link . '">'
. $caption . $caption
. "</a></li>\n" . "</a></li>\n"