Help Needed: HTML & Text files

Dear All,

Im am currently doing a website for a friend.
Im not really very good at the programming aspects of things and so I have stumbled upon a little challenging bump in the road.

Due to the fact that my site needs one simple page that is updated regularly in terms of text information, and I haven't really learn't advanced stuff like ASP and such:

- Would anyone here know of how to make your html page read the text from a .txt file that would be stored together with all of the pages on the server. This way, all my friend needs to do is every now and then change the text in the text file and upload the new file after changes have been made.  Somehow like the html file that is linked to it grabs the text from this one .txt file and displays it. (it would only be a relation between one page and one .txt file)

Any help on this would be much appreciated.

Thank you : ) - Excitedly awaiting any help.

Who is Participating?
Unfortunately, I don't think there is any way to do this without using server-side scripting such as asp.  Although, its not going to be as difficult as you think.

1) Give the file a .asp extension.
2) Insert (and modify) the following code for where you wish to insert the text on the page:

Dim objFSO, objText
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile(Server.MapPath("YourFile.txt"))

Do While Not objText.AtEndOfStream

Set objText = Nothing
Set objFSO = Nothing

Good luck

Do you have the asp compiler enabled on the server?
Or if you have a Java-enabled server, it's as simple as this:

<%@ include file="myfile.txt" %>

An alternative solution would be to embed a frame into the page, which loads the txt file, such as:

<iframe src="myfile.txt"></iframe>

But this most probably is not what you're looking for ..
Lee W, MVPTechnology and Business Process AdvisorCommented:
Very easy - server side includes.
Read the section here on Server Side Includes:
siamesefishAuthor Commented:
Thanks for all the comments! Im giving hairy mike the points cause he was the first.
but i appreciate all the rest very much. Thanks once again.

Well, you should really accept the comment that helped the most (not the first to post).
Either way, you _can_ also split the points..

(A little too late now, but next time ......)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.