Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep the header and footer consistant?

Status
Not open for further replies.

rahmanjan

Programmer
Apr 13, 2003
180
AU
hi all,

I have about 10-15 pages of HTML files. I have all similar Header and Footer to be kept in all the pages.

Ist is possible to keep this header and footer in a seperate file or anything so it will be consistant to all pages? And in case if it is needed to be changed i just changed it once.

regards

rahman
 
If your server can use SSI, read this tutorial by Wullie for how to do it that way: faq253-2000. If it doesn't, you'll have to use javascript.

Make a file and name it header.js. In that file, use document.write(); for each line of code you want to output, like this:
document.write("This is the first line of the header.");
document.write("This is the second.");


Make sure that you don't have any lines like this:
document.write("This is the first line of the header.
This is the second");

Javascript will break if you do that, and it will not work.

To include it in the page, simply do this:

<script type=&quot;text/JavaScript&quot; src=&quot;header.js&quot;></script>

And then just repeat the same for the footer.

Rick

-----------------------------------------------------------
RISTMO Designs
Arab Church
 
A way I've done it in the past has been to make my header and footer a graphic image. Every page has the same call and when you want to change it, you simply change the graphic image.

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
It wasn't the first thing I thought of at the time, either, but I had a client who wanted a very specific image to appear on every page and to have certain company contact information appear and for it to print perfectly and for it to be in a very specific font, etc.

I kept noodling with includes and various things such as that, but really, the thing that made them happy was when I just used an image. As far as they were concerned, it was beautiful and boy howdy was editing the footer easy after that!

Of course, this only works if it's non-active content.

The fella who maintained the site after I left was very grateful. During a meeting, he was told that some of the contact information had changed and one of his first tasks was to change the footer of every page on the website (300 or so static pages). When he discovered (after calling me in a slight panic) that it was a single 2k GIF, he was actually kinda giggly.

Ah, it's the little things...

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top