Jump to content

Home

Webcoding Question


swphreak

Recommended Posts

This is for you coders out there:

 

My boss likes to post records on the website, and he puts them on like 5 different pages. So when I go to update a record, I have to edit and reupload 5 different pages. Does anyone know of a way to make things easier?

 

I tried looking for a way to put the records on a 6th page by itself, and then use some scripting language to recall the numbers on the 5 pages. The end result I was aiming for was to just update the 6th page and upload it, and the 5 pages would have the new numbers.

 

Did that make sense to anyone? Also, I have absoultely no control over what is running/installed on the web host.

Link to comment
Share on other sites

This is for you coders out there:

 

My boss likes to post records on the website, and he puts them on like 5 different pages. So when I go to update a record, I have to edit and reupload 5 different pages. Does anyone know of a way to make things easier?

 

I tried looking for a way to put the records on a 6th page by itself, and then use some scripting language to recall the numbers on the 5 pages. The end result I was aiming for was to just update the 6th page and upload it, and the 5 pages would have the new numbers.

 

Did that make sense to anyone? Also, I have absoultely no control over what is running/installed on the web host.

 

Assuming that all the files you have are static HTML files and not dynamic files(eg. PHP, ASP, JSP etc.), you could accomplish this through javascript.

 

Let's say you want the same bit of html to appear on each page. In a text editor, type the following:

var mystrings=new Array();
mystrings[0]="Hello World.<br>";
mystrings[1]="<b>Bang!</b>";
mystrings[2]="Current value is 14";

Save this as data.js and upload it.

 

Then in your HTML wherever you want these strings to be imported use the following code in <head> portion.

<script type="text/javascript" src="data.js"></script>

and in the <body> area wherever you want these strings use the following:

<script type="text/javascript">document.write(mystrings[0]);</script>
<script type="text/javascript">document.write(mystrings[1]);</script>
<script type="text/javascript">document.write(mystrings[2]);</script>

 

Now, whenever you need to make a change, you'll only need to upload the new version of data.js. (You may have to clear your cache to notice the effect of your change.)

Link to comment
Share on other sites

That's exactly what I was thinking of. I just couldn't remember how to do it (haven't used JavaScript since High School). I knew it could be done. Thanks for the tip.

 

 

And no, I don't think they set up the webserver to use anything other than html. Maybe ASP, but nothing else.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...