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>
<ul>
<li><a href='merch.html'>Products</a></li>
<li><a href='cart.html'>Shopping Cart</a></li>
</ul>
</li>
<li><a href='past.html'>Past Shows</a>
<ul>
<li><a href='photos.html'>Photo Gallery</a></li>
<li><a href='vids.html'>Video Clips</a></li>
</ul>
</li>
</ul></div>
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:
http://php.net/manual/en/function.include.php
http://www.php.net/manual/en/function.include-once.php
http://php.about.com/od/tutorials/ht/template_site.htm
Enjoy!