How do I keep my site menu in one file?
If you have a site of more than a couple of pages, then PHP is your friend.
Infact, the include command we are about to meet is priceless on a large scale site and stops you needing to update a menu across many pages at once.
Here's how it works. You put the content you want to appear on all your pages in a file. So for instance the header content and the start of the body div. You then just do the below to include it on a page:
<?php
include("menu.html");//file containing your template code
?>
... then enter the rest of your content here.
Then just paste this at the top of each page you want your template to appear on, and away you go.
Often sites will have a header and footer include file.
Suddenly your website just got a little easier to manage and update!
More website PHP Questions
How to find a domain name for an IP address?How do I perform a 301 redirect with PHP?
How do I display todays date on my website?
How do I send HTTP headers with PHP?
How do I find a visitors IP address?