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

32 lines
920 B
PHP
Raw Normal View History

2018-02-06 23:11:50 +01:00
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
2018-02-08 00:20:00 +01:00
<div class="sidebar-sticky">
<?php
// Get all pages published
$pagesKeys = $dbPages->getPublishedDB();
foreach ($pagesKeys as $pageKey) {
// Build the page
$page = buildPage($pageKey);
// If the page is not a child this means the page is main page or parent page
if (!$page->isChild()) {
echo '<h6>'.$page->title().'</h6>';
2018-02-06 23:11:50 +01:00
2018-02-08 00:20:00 +01:00
// Get all children of the page
$childrenKeys = $page->children();
// Check if the page has children
if ($childrenKeys!==false) {
echo '<ul class="nav flex-column">';
// Foreach child
foreach ($childrenKeys as $childKey) {
// Build the child
$pageChild = buildPage($childKey);
echo '<li class="nav-item">';
echo '<a class="nav-link active" href="#">'.$pageChild->title().'</a>';
echo '</li>';
}
echo '</ul>';
}
}
}
?>
2018-02-06 23:11:50 +01:00
</div>
</nav>