Results 1 to 4 of 4

Thread: Displaying content from txt file

  1. #1
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Displaying content from txt file

    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.
    Last edited by anonymouse; 11-06-2005 at 10:39 PM.

  2. #2
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.
    Last edited by anonymouse; 11-07-2005 at 03:20 AM.

  3. #3
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, php seems to be the best bet so far. I'm working with the file read or fread function. Something like this:
    Code:
    <?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.

  4. #4
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •