I saw this code in the manual and though i could use something similar for a full site wide system for replacing text like [text] with data from a database
<?php
function callback($buffer) {
// replace all the apples with oranges
return (ereg_replace("apples", "oranges", $buffer));
}
ob_start("callback");
?>
<html>
<body>
<p>It's like comparing apples to oranges.
</body>
</html>
<?php
ob_end_flush();
?>
There are 2 main things i would like to know (I have not got access to PHP for about an hour or so, so cannot try.)
First:
ob_start("callback");
Can i call more than one function???
Like
ob_start("callback" "ob_gzhandler");
As i would like to try gz (the plan is to have a low size site for a lot of people. But we need to conserve bandwidth until we can get the bigger servers, also we are not planning 24 hour gz, just low hit times so that the CPU is not too used up.
The next thing is this:
function callback($buffer) {
// replace all the apples with oranges
return (ereg_replace("apples", "oranges", $buffer));
}
I assume that i could change the functon to this:
function callback($buffer) {
ereg_replace("apples", "oranges", $buffer);
ereg_replace("oranges", "apples", $buffer);
return ($buffer);
}
which would be much more usefulle 😉
Thanks All,
PS i am making this site as a learning thing, rather than the quick and easy way i will use a longer approach which is usually used in bigger websites.