hi,
I am using output buffering with ob_start and a callback function, which
replaces variables like "%var%" with the equivilants taken out of a
mysql database. This works well! But I get sometimes php timeouts (max
execution time (30s) exceeded ...). The Server should be really fast
enough (dual PIII, >1 GB RAM) and runs with PHP 4.1.2 and MySQL 3.23.56.
Any suggestions? Known Probs?!
I am still trying to find a solution by my self ( and an error in my
script) ... but hopefully someone can give me a hint ...
cu :: cal
full code:
// ---------------------------------------------
// replace all internal vars (%..%) in string
// ---------------------------------------------
function html_replacevars($tmp) // input urldecoded
{
global $mysql;
db_connect();
// replace all %*% in value
for ($i=0;$i<2;$i++) // twice because of recursive use of %*%
{
$result = db_result("Select * FROM $mysql[settings] WHERE
variable LIKE '\%%'");
while ($row = mysql_fetch_array($result))
{
$rvar = urldecode($row[variable]); // %var%
$rval = urldecode($row[value]); // realvalue
$tmp = str_replace($rvar, $rval, $tmp);
}
}
@mysql_close();
return $tmp; // output urldecoded
}
ob_start("html_replacevars")
[..]
output
[..]
ob_end_flush();