<?php
// un tableau qui d\'efinit la structure du site
$mymenu = array(
// idPage titre
'index' => array( 'Accueil' ),
'profil_affichage' => array( 'Profil' ),
'profil_modif' => array( 'Modifier mon profil' ),
'aliments' => array('Aliments'),
'journal' => array('Journal')
);
function renderMenuToHTML($currentPageId) {
global $mymenu;
// ...
$id='';
echo '<nav class="navbar navbar-expand-lg bg-secondary text-uppercase fixed-top" id="mainNav" > <div class="container"> <a class="navbar-brand js-scroll-trigger" href="#page-top">Manger mieux </a> <div class="collapse navbar-collapse" id="navbarResponsive"> <ul class="navbar-nav ml-auto">';
foreach($mymenu as $pageId => $pageParameters) {
if ($pageId == $currentPageId){
$id=" id='active'";
}
else{
$id="";
}
echo ' <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger"'.$id.' href= "index.php?page='.$pageId.'">'.$pageParameters[0].'</a></li>';
}
echo '</ul> </div> </div> </nav>';
}
?>
-
Raulin authored952306b5