Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

triton

macrumors regular
Original poster
Jul 15, 2003
172
0
Hello,

I have to periodically update a copyright footer on several html pages, but do not want to have to update each and every single page to do this.

Is there a way to update one page and have that universally linked onto each page? :confused:
 

CoMpX

macrumors 65816
Jun 29, 2005
1,242
0
New Jersey
I don't know much about HTML, but I think I have a solution for you.

Save the copyright notice as an image file. Then host this image on your server, ad link the image onto the bottom of every page.
This way, when you update your copyright notice all you have to do is host the new image file and link to it. It will change on all of the pages.

Too complicated? Maybe someone has a better way?
 

buzzmedia

macrumors newbie
Aug 16, 2006
2
0
Windsor, ON
You can do this a few ways. The easiest way is to use a server-side scripting language like PHP, ASP, SSI, etc. and code your footer as a separate page, and then "include" it in all of your other pages. This way, you make the change once, and all other pages will get updated automatically. If PHP, ASP, etc. is not an option, then you can do the same thing using Javascript. Within each page on your site, include a link to a javascript file. For example:

Code:
<script language="JavaScript" src="JAVASCRIPTFILENAME.js"></script>

Within that Javascript file, include a function called "writeFooter" (or whatever you want to call it) that looks something like this:

Code:
function writeFooter() {
 document.write("Copyright 2006 - My Site & Me");
}

Then at the bottom of each page where you want the copyright information in your HTML, put this line

Code:
<script>writeFooter();</script>
 

Butters

macrumors 6502
Jan 7, 2006
256
0
UK
if your host supports php scripting

type
Code:
<? include 'footer.php' ?>
at the bottom of everypage where you want the copyright notice to appear

and then make a new file called footer.php and type the copyright notice into it, upload the file to your server and now wherever the include footer code appears it will grab footer.php and include it

edit: was beaten to the solution, both ways will work this one and the one mentioned above.
also, if you use the php method make sure ur html files are saved with the .php extension
 

elppa

macrumors 68040
Nov 26, 2003
3,233
151
Butters solution is far better.

Anything that uses javascript can be (and frequently is) turned off.
 

triton

macrumors regular
Original poster
Jul 15, 2003
172
0
Butters said:
if your host supports php scripting

type
Code:
<? include 'footer.php' ?>
at the bottom of everypage where you want the copyright notice to appear

and then make a new file called footer.php and type the copyright notice into it, upload the file to your server and now wherever the include footer code appears it will grab footer.php and include it

edit: was beaten to the solution, both ways will work this one and the one mentioned above.
also, if you use the php method make sure ur html files are saved with the .php extension

Thank you, I'll let you know how it goes ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.