0
I made the menu of a system I am doing in html and php, I wanted to insert this menu in all pages, however I wanted to change the active menu according to the open page, is possible ? My current menu is in html for now:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script defer src="js/fontawesome-all.min.js"></script>
<?php
require 'config.php';
//require 'verificalogin.php';
$sql = new Sql();
$nome = $_SESSION['nome'];
?>
<link rel="stylesheet" href="css/cssbase.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrativo DoUp</title>
</head>
<body>
<!-- inicio da navbar -->
<header>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="imagens/logo.png" id="logo">
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Inicio</a></li>
<li ><a href="noticias.php">Noticias</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fas fa-user-circle fa-lg"></i>
<strong>Igor de Oliveira</strong>
<i class="fas fa-caret-down "></i>
</a>
<ul class="dropdown-menu">
<li>
<div class="navbar-login">
<div class="row">
<div class="col-lg-8">
<p class="text-left"><strong>Igor Oliveira</strong></p>
<p class="text-left small">[email protected]</p>
<p class="text-left small">Praia da Costa</p>
<p class="text-left">
<a href="#" class="btn btn-primary btn-block btn-sm">Alterar Senha</a>
</p>
</div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="navbar-login navbar-login-session">
<div class="row">
<div class="col-lg-12">
<p>
<a href="#" class="btn btn-danger btn-block">Deslogar</a>
</p>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</header>
</body>
</html>
It worked, but the rest of the content is under the menu, would know how to leave it under the menu in an elegant way without margin top?
– Igor Oliveira
I think the ideal would be include
<?php include 'header.php';?>
because with the require, if the . php does not find the file it will lock the whole page loading.– hugocsl