Jason Jason - 1 month ago 5x
HTML Question

How to store nav bar in one file?

I have a navigation bar for my website:

<div id='menu'><ul>
<li><a href='index.html'>Home</a></li>
<li><a href='about.html'>About Us</a></li>
<li><a href='http://www.brownpapertickets.com' target=_blank>Ticket Sales</a></li>
<li><a href='merch.html'>Merchandise</a>
<li><a href='merch.html'>Products</a></li>
<li><a href='cart.html'>Shopping Cart</a></li>
<li><a href='past.html'>Past Shows</a>
<li><a href='photos.html'>Photo Gallery</a></li>
<li><a href='vids.html'>Video Clips</a></li>

I want to store this in one central place so that every time I have to add a hyperlink or something I don't have to edit every single file. What's the best way to do this?


Assuming you are using a scripting language such as PHP, you simply save that HTML above in a php file called header.php (or something to your liking)

Then in your other php files you write:

include_once('header.php'); and it will plop that HTML right in there.

Some resources for you: