ja.son-williams.ca/www/themes/jason-williamsca/partials/mainmenu.htm
JayWll 1c9de8f4b5 Restoring onStart() function to menu menu partial
Code determines which section of the site is current and applies the relevant classes to the menu items
2020-05-16 15:14:47 -06:00

44 lines
2.2 KiB
HTML

description = "Main Site Menu"
==
<?php
function onStart()
{
// Determine the acive section of the site in order to customize the navigation
$this['activeSection'] = explode('/', $_SERVER['REQUEST_URI'])[1];
}
?>
==
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item {% if activeSection == '' %}active{% endif %}">
<a class="nav-link" href="/">Home {% if activeSection == '' %}<span class="sr-only">(current)</span>{% endif %}</a>
</li>
<li class="nav-item {% if activeSection == 'feed' %}active{% endif %}">
<a class="nav-link" href="/feed">Feed {% if activeSection == 'feed' %}<span class="sr-only">(current)</span>{% endif %}</a>
</li>
{% if activeSection != 'resume' %}
<li class="nav-item">
<a class="nav-link" href="/resume">Résumé</a>
</li>
{% else %}
<li class="nav-item active d-none d-lg-inline-block">
<a class="nav-link" href="/resume">Résumé</a>
</li>
<li class="nav-item dropdown active d-lg-none show">
<a class="nav-link dropdown-toggle" href="/resume" id="resumeDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">Résumé</a>
<ul class="navbar-nav" aria-labelledby="resumeDropdown">
<li class="nav-item"><a class="dropdown-item" href="#">Summary</a></li>
<li class="nav-item"><a class="dropdown-item" href="#">Skills &amp; Expertise</a></li>
<li class="nav-item"><a class="dropdown-item" href="#">Experience</a></li>
<li class="nav-item"><a class="dropdown-item" href="#">Education</a></li>
<li class="nav-item"><a class="dropdown-item" href="#">Certifications</a></li>
</ul>
</li>
{% endif %}
</ul>
</div>