Reply to Re: Flushing outout to screen - ob_flush()

Your name:

Reply:


Posted by J.O. Aho on 01/23/06 02:40

Jay wrote:
> I have a script that I want to output to the screen (browser) in 2 parts:
> 1st part works fast (query of datbase and ouput to screen)
> 2nd part performs a javascript action which takes time.

Javascript is executed on the client browser, if it takes long time to
execute, then the surfer should get a faster computer.


> Is it possible to first output to screen the 1st part of the code (this way
> user has some information to look at)
> then ... perform the javascript?

If you would flush() the things in two parts, then you will only delay the
time before the client gets the javascript and then they have to wait as long
as now with that the javascript will be executed.

<?PHP
ob_start();
echo "html";
flush();
echo "javascript";
ob_end_flush();
/* at this stage the javascript will begun to be executed */
/* so the long wait will start now - better not save any */
/* thing in the buffer and let everything go out at once */
?>


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация