Web Hosting Talk







View Full Version : Including header file using HTML


SharonB
03-30-2008, 02:30 PM
Is it possible to include a header and footer file using HTML? I have my file as a .html and need to be able to include the HTML for the header and footer. Anyone know how I can do this?

WebDesignGold
03-30-2008, 02:49 PM
It depends on your server configuration. It must be set to parse html pages by php parser. Then you'd just use <?php include("your_file.php"); ?>

ozona
03-30-2008, 05:45 PM
Why not just copy paste the header into the file itself?

I don't really understand what you are trying to do here.

WebDesignGold
03-31-2008, 10:48 AM
Why not just copy paste the header into the file itself?

I don't really understand what you are trying to do here.
Here's the benefit of using the include method:
Say you have a 100 pages website and your header stuff including the top navigation is hardcoded (copy & paste as you suggested) into every file. Now you want to add a menu element to your navigation. How do you do that the easy way? copy and paste into every single file? no.. if you're using only one file for your header stuff, you only edit that file.. the include method will do the rest for you :)
The same applies for your footer stuff.