Results 1 to 7 of 7
Thread: PHP Parsing Problems!
-
04-14-2005, 09:33 PM #1Disabled
- Join Date
- Aug 2003
- Posts
- 77
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
-
04-14-2005, 09:38 PM #2Newbie
- 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
-
04-14-2005, 09:38 PM #3Web Hosting Master
- 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.
-
04-14-2005, 09:40 PM #4Web Hosting Master
- 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);
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.
-
04-14-2005, 09:42 PM #5Newbie
- 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?
-
04-14-2005, 09:42 PM #6Web Hosting Master
- Join Date
- Mar 2002
- Location
- New York
- Posts
- 1,700
Check my edit..
-
04-14-2005, 09:47 PM #7Newbie
- Join Date
- Nov 2004
- Location
- Illinois
- Posts
- 24
Ok, after taking your advice the template file now works. Thanks for your help.