PDA

View Full Version : Pulling data from flatfile into html page...??


wfcentral
05-20-2003, 11:35 PM
I have a great web-based calendar I've been using for years. It stores all the events in a flat text file. I would love to be able to pull the next 5 days events into my main welcome page.

I am a moderate CGI programmer so I'm kinda lost here... what is the easiest way to get some flat data into a page? I don't want to turn my index.html page into index.cgi

I want it to stay index.html and have code in the page that pulls in and formats the text...

I think this is about as vague as I can get (grin)...

chrisvmarle
05-21-2003, 12:31 PM
You should open the file and then run through each file...

(too be vague too)

Mzzl, Chris

P.S.
open(FILE,"file.txt") || die("Couldn't open file");
@lines = <FILE>;
close(FILE);

foreach $line (@lines) {
chomp($line);
print "$line";
}

wfcentral
05-21-2003, 03:28 PM
In order to use this won't it have to be in a file called *.cgi ?? I'm trying to find a way to do it inside a file called home.shtml

chrisvmarle
05-21-2003, 05:47 PM
You could create a .cgi and use SSI to include it in a .shtml