HTML Menu - write once and include

Soldato
Joined
6 Mar 2008
Posts
10,079
Location
Stoke area
Hi all,

Creating my own photography site using Bootstrap, my html and css is ok, I can get by and understand a fair bit, javascript and php are rubbish and the reason for building my sites so I have places to learn.

Instead of me writing my menu out and editing it in each html document, then having to edit everyone each time I add a page, what is the best way of having a single menu file and just importing that into each page?

Would you then use Javascript to find which link is the active one and adjust the menu accordingly so the active page would be highlighted in the menu?
 
Soldato
OP
Joined
6 Mar 2008
Posts
10,079
Location
Stoke area
Yeah I tried php includes as well as some html includes I found but no joy.

I've created menu.php that holds the header div with the nav bar information in it.

I've then used <?php include("menu.php"); ?> inside a container div within the new php file. Just shows a blank screen. I've popped a <p> tag afterwards and that appears but 1/4 of the way over the line.

Think i'll have to try it on a live server instead of the usbwebserver, see if it's something on their playing up.
 
Back
Top Bottom