View Full Version : Displaying content from txt file
anonymouse
11-06-2005, 10:27 PM
I'm looking for a way to generate content on a page from a .txt file. For example, a page says "today's rate is:" then that number would be in a txt file. If possible, numbers for various rates would be in the same txt file, then each individual page would call up a specific line.
I hope this isn't too confusing. Even if the last part isn't possible, I'd be grateful for anything. Thanks!
edit: it doesn't necessarily have to be a .txt file, just something with no code...the idea is for easy updating without sifting through code.
anonymouse
11-07-2005, 03:15 AM
Well, I think I might be able to do something with javascript and a document.write function, still working on it though. Any ideas?
Or maybe something with php fread? I don't really know any php, though, so don't know where to go with that.
anonymouse
11-07-2005, 04:11 AM
Well, php seems to be the best bet so far. I'm working with the file read or fread function. Something like this:
<?php
{
$myFile = "rate.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 9);
fclose($fh);
echo $theData;
}
?>
I figured out how to only get part of the file, but only if it starts at the beginning. Does anybody know how I would, say, start 10 characters in and go to 15, instead of just going from the first character? Thanks.
anonymouse
11-07-2005, 07:51 AM
Guess I've figure out some options, but still figuring out the php. I put a thread in php, not to have duplicate topics, but once I found things, my questions became very specific to php, so i thought it would be best to ask there.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.