templates/fread...

From: Date: Tue, 22 Apr 2003 17:00:46 +0000
Subject: templates/fread...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144869@lists.php.net to get a copy of this message
Hi Everyone, I have the following function: function show ($template, $tag) { $file = fopen ($template, "r") or die($error_string()); while (!feof($file)) { $line_in = fgets($file, 1024); $line_out .= $line_in; } if ($tag != 0) { foreach ($tag as $name => $value) { $line_out = str_replace ("%$name%", $value, $line_out); } } return $line_out; fclose ($file); } Simply, its loading in a text file, replacing tags formatted as %tag%, %first_name%, etc.. anything %..% with the value of the $tag array. This is working ok except for one minor glitch. Sometimes when our qa testers are testing it (2 people), it appears to cut off part of the page, and only display the last so much of it (different everytime). I don't think there's a problem with this method. I'm sure there are better ways to do this (and feel free to give a suggestion), however, do you see anything wrong with this function? Any reason why it would cut it off? Please keep in mind I haven't experienced troubles, neither have a couple others. -Dan Joseph

« previous php.general (#144869) next »