|
-
Sep 25th, 2002, 11:03 AM
#1
Thread Starter
Member
Add txt to web page from txt file on load
I have made a nice website but require a few numbers to be taken from a txt file when the website is loaded and placed in certain paragraphs and tables on the page.
What is the easiest way to do this. Any examples would be handy too.
Cheers in advance
Nick
-
Sep 25th, 2002, 11:50 AM
#2
Black Cat
SSI (server side includes) would be easiest if you can load the entire text file into one place.
Code:
<!-- #include file="file.txt" -->
Else you are going to have to use a CGI related technology (Perl, PHP, ASP, JSP, etc) to parse the text file for the data you want and generate the web page.
Either way, your web server needs to support it.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Sep 25th, 2002, 12:01 PM
#3
Thread Starter
Member
CGI is the only option. Any tips on how I would do this?
The other thing i've been told about is document.write. Can this perform the task?
-
Sep 25th, 2002, 01:03 PM
#4
Black Cat
Originally posted by skuzzle
CGI is the only option. Any tips on how I would do this?
The other thing i've been told about is document.write. Can this perform the task?
document.write is client-side javascript - you most likely need a CGI script to generate that anyway, unless your text file is already javascript code.
Doing it with CGI shouldn't be too hard. What languages do you have avaliable? Perl would be like:
Code:
open(INPUT, "file.txt");
#loop and parse thru the file to find the data
# store it in variable $data
close(INPUT);
#write the html
print "<td>Data is $data</d>";
#...
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|