Fix bug that prevented the active page from being marked in nav
This commit is contained in:
parent
02f54c4458
commit
0d0305cf04
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue