Methodologies for serving a static header

Associate
Joined
17 Jan 2003
Posts
1,058
So a common? issue - a website with a common header (logo, menu, contact details etc) to be served across many pages. I t make sense to have a single instance.

Now in ASP.net you can just use a masterpage but if it's only an html (and PHP) site what method would you use: Javascript, PHP or ?
 
Soldato
Joined
18 Oct 2002
Posts
15,411
Location
The land of milk & beans
Use PHP:

Code:
include 'header.php';

Or HTML (assuming your server allows SSI)

Code:
<!-- #INCLUDE FILE="header.html" -->

Don't use Javascript as there will be a delay between the page loading and the heading appearing, plus it will mean another request on the server which is rather pointless in this instance.
 
Soldato
Joined
4 Oct 2008
Posts
6,693
Location
London
What Spunkey said, is this for a project at school, or a site your making yourself, it seems better to use some sort of framework, or open source CMS depending on what your doing. If it is just a few simple pages then it might be better to just include a header and a footer.
 
Back
Top Bottom