Loser's Guide Loser's Guide

 Loser's Guide to Life

Wednesday, September 17, 2008

Useful Use of Something 

I thought of something that could be useful but I couldn't come up with any actual way for it to be useful until just now.

Supposing you had a website at, for example, http://www.mybalblabla.net, and you need to update some section of it every so often. Maybe there's a column at the side with “latest stuff” in it or something. But it's bit of a bore getting hold of this big html file and finding the spot, editing it, saving it, viewing it, then going back and fixing all the stuff you messed up accidentally.

So what you do is just put something like this in the update spot: <script type="text/javascript" src="update.txt"></script>.

Then what you do is make a text file called “update.txt” which contains, on a single line:

document.write('<p>The text etc...</p>')

—making sure to use escape characters (\' and \") for apostrophes and quotation marks. You can of course put as much content as you want, links, images, and so on, as long as there are no line breaks. Then you save that and upload it.

The advantage is that it would be quicker and easier to re-edit. Also, as long as you have the path correct, you could save this .txt file on a different server. Theoretically, you could replace all the content of your website from time to time without even touching it, merely by editing (or replacing) this remote txt. file. That might be...useful.



Post a Comment

Watching TV is a good way to tear yourself away from the computer.