| 
	
 | 
 Posted by windandwaves on 06/19/07 11:31 
Berimor wrote: 
..... 
> Note: As of PHP 4, you can use output buffering to send output prior 
> to the call of this function, with the overhead of all of your output 
> to the browser being buffered in the server until you send it. You 
> can do this by calling ob_start() and ob_end_flush() in your script, 
> or setting the output_buffering configuration directive on in your 
> php.ini or server configuration files. 
 
 
I just started to use this.  It is absolutely f. brilliant!  I now delete  
any extra spaces in my html using this system using the function below: 
 
function trimmer($buffer) { 
 $buffer = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/","\n",$buffer); //strip  
blank lines (blank, with tab or whitespaces) 
 $buffer = trim(str_replace("\r\n", " ", $buffer)); //removes line-breaks 
 $buffer = trim(str_replace("\n", " ", $buffer)); 
 $buffer = trim(str_replace("\t", " ", $buffer)); //removes tabs 
 $buffer = trim(eregi_replace(" +", " ", $buffer)); //removes spaces 
 return $buffer; 
} 
 
Works a treat.  It makes the loading funny, because before I used this  
function, I would slowly see the page being developed on the screen, while  
now, you see a blank space for about a second and then the whole page shows  
up at once. Something I also noticed on www.cnn.com, while my local  
newspaper www.stuff.co.nz does it my old way (you slowly see the page being  
build).
 
[Back to original message] 
 |