including txt file in HTML?

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
I've got this webpage, and want some of the content to be "dynamic"- in that it loads up some txt file in the directory. In that way I can just modify the txt file and have the homepage change rather than having to modify the html.

How can i do this?

Thanks
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Depends on what server-side scripting your hosting company offers for your server -- ASP, PHP, JSP etc.

Tell us what your hosting account is set up for (visit your hosting company sales / support pages to find out) and tell us whether its an IIS or Apache server if you can find out.

For most it would be simple to embed a fixed block of script code to "insert text file here" in the middle of your page.
 

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
I was hoping it wouldnt' be that complicated. THere is no way to have somethign simply like "embed src = text.txt" or "embed src = text.html"?

I've used cold fusion programming, in that its SO simple, you just say "cfinclude template = "text.txt"" and it will include the text file in the html.

I'm not too sure what kind of server my host is running, I didn't think i needed to?

Thanks

 

OZEE

Senior member
Feb 23, 2001
985
0
0
I think you're going to have to know what your host offers for this to happen... Even cold fusion has to be supported at the server side for this to work.

My recommendation -- give it a try! If it doesn't work, you've lost nothing. If it does, you've won.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
if your web server supports server side include (SSI), you can write a simple perl script that goes out to read the text out of a file and print them line by line to the html output ...

otherwise, write your whole html page in cgi/jsp/asp and the likes?
 

Boogak

Diamond Member
Feb 2, 2000
3,302
0
0
Try the most common server side include tag?

<!-- #include file="dynamic.txt" -->

There's a list of more common include tags here.