Forum Moderators: coopster
Is there any function, or any way I could filter my output without having to do it variable by variable?
for example :
str_replace("the site","the site", THE_ENTIRE_PAGE_OUTPUT_HERE);
so that it searches for "the site" in my entire page output and make the site bold...
any idea?
p.s there are A LOT OF VARIABLES being "echo"ed on the page, it takes so much time and effort if I apply str_replace for all of them...
$html = [url=http://www.php.net/ob-get-contents]ob_get_contents[/url]();
$to_replace = [url=http://www.php.net/array]array[/url](
"/(the site)/",
"/(test text)/",
"/(etc)/");
#
echo [url=http://www.php.net/preg-replace]preg_replace[/url]($to_replace, "<b>\\1</b>", $html);
Try to play around with that and see what you can get working from it.
Just don't know where to put the "echo preg_replace" line . in the last line of the document?
example :
<?php
echo variable1;
echo variable2;
...
echo ariable10;
?> now i make it like :
<?php
ob_start();
echo variable1;
echo variable2;
...
echo ariable10;$html = ob_get_contents();
$to_replace = array(
"/(the site)/",
"/(test text)/",
"/(etc)/");
#
echo preg_replace($to_replace, "<b>\\1</b>", $html);
?>
like i put it on the site footer? (to be included in everypage?)