bludit/bl-themes/docsx/php/sidebar.php

28 lines
711 B
PHP
Raw Normal View History

2018-02-17 11:32:05 +01:00
<nav class="sidebar">
<?php
// Get all parent pages
$parents = buildParentPages();
foreach ($parents as $parent) {
// Print the parent page title
echo '<h6 class="text-uppercase">'.$parent->title().'</h6>';
2018-02-06 23:11:50 +01:00
2018-02-17 11:32:05 +01:00
// Check if the parent page has children
if ($parent->hasChildren()) {
// Get the list of children
$children = $parent->children();
2018-02-17 11:32:05 +01:00
echo '<ul class="nav flex-column">';
foreach ($children as $child) {
if ($child->key()==$url->slug()) {
echo '<li class="nav-item-active">';
} else {
echo '<li class="nav-item">';
2018-02-08 00:20:00 +01:00
}
2018-02-17 11:32:05 +01:00
echo '<a class="nav-link" href="'.$child->permalink().'">'.$child->title().'</a>';
echo '</li>';
2018-02-08 00:20:00 +01:00
}
2018-02-17 11:32:05 +01:00
echo '</ul>';
2018-02-08 00:20:00 +01:00
}
2018-02-17 11:32:05 +01:00
}
?>
2018-02-06 23:11:50 +01:00
</nav>