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!
Comment on this Question and Answer >>>
ASK A QUESTION
More website PHP Questions
How can I find out where a site visitor comes from?Help : how to automatically upload files every 5 minutes ? Hi , Can anybody help me with this php code : I want to read the file names from a folder ( word document files or media files with extentions) and enter the url of the files in mysql d
I would like to browse to a url eg http://mysite.com/index.html and dump the content of that site in a variable eg $htmlDump?
I have a main WEB page that will be sereved. This page has text data on it that will come from a file(iframe). The data in the file will be changed when other applications make requests to the apache server to server data from a database. When this hap
How do I perform a 301 redirect with PHP?
