Hi,
In many of my apps I read in a HTML file line by line, do some string
substitutions and then print out the file line by line to the browser,
for example:
$fragment_to_show_handle = @fopen("page.html", "r");
while ( !feof($fragment_to_show_handle) ) // while not end of file
{
$line = fgets($fragment_to_show_handle, 1000);
$line = str_replace("%pics%", $pics, $line); // do the
substitutions one at a time
$line = str_replace("%currency_select%", $currency_select, $line);
// etc
print "$line"; // print the line to browser
}
fclose($fragment_to_show_handle);
Alternatively, in another app I have done this:
$home_html = implode ('', file("$fragments/home.html"));
$home_html= str_replace("%applet_code%",$applet_code,$home_htm l);
$home_html=str_replace("%pics%",$pics,$home_html);
// etc
print "$home_html";
Assuming the total output to the browser is the same, say about
20-50k, which approach is more efficient in a php/apache/unix
environment in terms of speed and least server load?
Many thanks,
KEvin