note 33607 added to function.flush
| From: | u_ri_p_ui at yahoo dot de | Date: | Tue, 01 Jul 2003 20:42:31 +0000 |
| Subject: | note 33607 added to function.flush | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51313@lists.php.net to get a copy of this message | ||
Thanks to Alexander Keilonat and chris_lewis! Without your
help I woudn't have managed this:
it's probably usable for a chat system where messages are
streamed directly and after 100 lines the whole browser
window is cleaned.
-----------------------------------------------------------
<html>
<head>
<title>Streaming-HTML-Test</title>
</head>
<body>
<div id="id1"></div>
<?php
echo str_pad(" ", 256);
echo "\n";
for ($a=1; $a<=5; $a++)
{
echo "<script type=\"text/javascript\">\n";
echo "document.getElementById(\"id1\").innerHTML=\"\";\n";
echo "</script>\n";
for ($i=1; $i<=10; $i++)
{
echo "<script type=\"text/javascript\">\n";
echo "document.getElementById(\"id1 --
\").innerHTML=document.getElementById(\"id1 |- One line
\").innerHTML+\"Chat-Nachricht $a.$i</ br>\";\n"; --
echo "</script>\n";
flush();
ob_flush();
sleep(1);
}
}
?>
</body>
</html>
----
Manual Page -- http://www.php.net/manual/en/function.flush.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33607
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33607&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33607&report=yes