32 lines
920 B
PHP
32 lines
920 B
PHP
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
|
<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>';
|
|
|
|
// 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>';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</nav>
|