Results 1 to 7 of 7
  1. #1

    PHP Parsing Problems!

    Well, i'm starting up a site. It uses a pretty simple php engine. The skin system uses and fread and fwrite, although when it outputs my pages sometimes it doesnt parse all the HTML from the template file! Do you guys think its something with the server, or the script;

    http://www.dsreviewed.com/game1.htm
    Click that link, and refresh a few times. After like 1-3 times it will show a messed up page (because for whatever reason it cant parse it anymore)

    Here is the code;
    http://www.dsreviewed.com/game.txt

  2. #2
    Join Date
    Nov 2004
    Location
    Illinois
    Posts
    24
    I don't know why this is happening as well. I thought that I programmed the code correctly, because it seems to work on other sites well. Here is the other part of the code that does the FReading and FWriting.

    http://www.dsreviewed.com/template.txt

    I don't know if this is true or not, but I believe that the template program that I use can't process a file that is as huge as the template file that is being used there.

    Thanks for the help in advanced,
    DemoIXI

  3. #3
    Join Date
    Mar 2002
    Location
    New York
    Posts
    1,700
    Looks like there's a problem on the server side with the file getting locked up and accessed to many times.

  4. #4
    Join Date
    Mar 2002
    Location
    New York
    Posts
    1,700
    Ah ok...

    Code:
    		$this->filename = $filename;
    		$handle = fopen($this->filename, "r");
    		$this->template = fread($handle, 1000000);
    		$this->$original = $this->template;
    		fclose($handle);
    Try adding some error handling to print out if the connecting to the file failed.


    I also reccommend using file_get_contents() as it works very nicely for this type of application, it creates a perfect buffer each time, just set $this->template = to the filename, and it will put the entire thing into that varible.

  5. #5
    Join Date
    Nov 2004
    Location
    Illinois
    Posts
    24
    Is it possible to fix the this problem if I make the size of the 'freading' function process more bytes then it currently is?

  6. #6
    Join Date
    Mar 2002
    Location
    New York
    Posts
    1,700
    Check my edit..

  7. #7
    Join Date
    Nov 2004
    Location
    Illinois
    Posts
    24
    Ok, after taking your advice the template file now works. Thanks for your help.

Posting Permissions

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