How do I create an external file for my side menu?
<a class="active" href="C.html" style="font-size: 1.1em;font-weight: 900;">C Programming</a>
<a href="C++.html" style="font-size: 1.1em;font-weight: 900;">C++</a>
<a href="CSharp.html" style="font-size: 1.1em;font-weight: 900;">C#</a>
<a href="Go.html" style="font-size: 1.1em;font-weight: 900;">Go</a>
<a href="Java.html" style="font-size: 1.1em;font-weight: 900;">Java</a>
<a href="JavaScript.html" style="font-size: 1.1em;font-weight: 900;">JavaScript</a>
<a href="PHP.html" style="font-size: 1.1em;font-weight: 900;">PHP</a>
<a href="Python.html" style="font-size: 1.1em;font-weight: 900;">Python</a>
<a href="Ruby.html" style="font-size: 1.1em;font-weight: 900;">Ruby</a>
<a href="Swift.html" style="font-size: 1.1em;font-weight: 900;">Swift</a>
Currently I have these kind of links in every file and the code is just getting too much. Is there a way to create an external file for the menu items?
I tried this but the problem is class="active"
. I want to highlight a menu item when my menu item is in index.php
I Know how to achieve this when my menu is in each individual HTML file but how do I do that when it's in external PHP file ?
Index.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="CSS/Tags.css">
<link rel="stylesheet" type="text/css" href="CSS/Nav.css">
<link rel="stylesheet" type="text/css" href="CSS/Card.css">
<link rel="stylesheet" type="text/css" href="CSS/Buttons.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="sidenav">
<h1> Others</h1>
<a href="" style="font-size: 1.1em;font-weight: 900;">MS Excel</a>
<a href="" style="font-size: 1.1em;font-weight: 900;">MS PowerPoint</a>
<a href="" style="font-size: 1.1em;font-weight: 900;">MS Word</a>
<a href="" style="font-size: 1.1em;font-weight: 900;">WordPress</a>
</div>
</body>
</html>
Main file
<?php include('index.html'); ?>