473,467 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Solution to display on a web page each second a new line wanted

Hallo

I'm looking for a solution to display on a web page each second a new
line.
Unfortunately does the following solution not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-withtable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
echo "<table border = '1'>";

for ($counter = 0; $counter <= 5; $counter++) {
echo "<tr><td>" . $counter . "<br></td></tr>";

ob_flush();
flush();
sleep(1);
}

echo "</table>";
?>
</body>
</html>
Even if I do it without a table it does not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-notable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
for ($counter = 0; $counter <= 5; $counter++) {
echo $counter . "<br>";

ob_flush();
flush();
sleep(1);
}
?>
</body>
</html>
Does someone know a solution which works also with the Internet
Explorer?

Regards
Stefan

PS: Both solutions work with Mozilla and Opera.
Aug 3 '08 #1
4 1733
On 3 aug, 03:12, Stefan Mueller <seekw...@yahoo.comwrote:
Hallo

I'm looking for a solution to display on a web page each second a new
line.
There are two typical solutions for this:
1) You use Javascript to retrieve a new line every second, AJAX style.
2) You output a page which reloads itself every second and pass a new
line to it each time.
* * * * * for ($counter = 0; $counter <= 5; $counter++) {
* * * * * * echo $counter . *"<br>";

* * * * * * ob_flush();
* * * * * * flush();
* * * * * * sleep(1);
* * * * * }
Interesting approach. What you do is send the first part of the page
to the client, wait a second, send another line, etc. The call to
sleep(1) makes the server wait before outputting anything else. So the
webbrowser does not receive the whole page until all lines have been
printed. The browser may wait until it has received the whole page
before rendering it (as IE does).
PS: Both solutions work with Mozilla and Opera.
This is because they try to render the page while it has not been
fully retrieved yet, but you can not really depend on this.
Aug 3 '08 #2
Stefan Mueller wrote:
Hallo

I'm looking for a solution to display on a web page each second a new
line.
Unfortunately does the following solution not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-withtable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
echo "<table border = '1'>";

for ($counter = 0; $counter <= 5; $counter++) {
echo "<tr><td>" . $counter . "<br></td></tr>";

ob_flush();
flush();
sleep(1);
}

echo "</table>";
?>
</body>
</html>
Even if I do it without a table it does not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-notable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
for ($counter = 0; $counter <= 5; $counter++) {
echo $counter . "<br>";

ob_flush();
flush();
sleep(1);
}
?>
</body>
</html>
Does someone know a solution which works also with the Internet
Explorer?

Regards
Stefan

PS: Both solutions work with Mozilla and Opera.
Yes, it might work in some browsers and not others. What should happen
in this case is undefined and browsers are left to their own devices on
how to implement it.

As Sjoerd indicated, AJAX can do it. Flash and Java applets can also do it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 3 '08 #3
On Sat, 2 Aug 2008 18:12:38 -0700 (PDT), in comp.lang.php Stefan
Mueller <se******@yahoo.com>
<67**********************************@k37g2000hsf. googlegroups.com>
wrote:
>| Hallo
|
| I'm looking for a solution to display on a web page each second a new
| line.
| Unfortunately does the following solution not work with the Internet
| Explorer:
|
| http://test.seekware.ch/test/flush-withtable.php
|
| PHP code:
| <html>
| <head>
| <?php
| header("cache-control: no-cache");
| header("pragma: no-cache");
| ?>
| </head>
|
| <body>
| <?php
| echo "<table border = '1'>";
|
| for ($counter = 0; $counter <= 5; $counter++) {
| echo "<tr><td>" . $counter . "<br></td></tr>";
|
| ob_flush();
| flush();
| sleep(1);
| }
|
| echo "</table>";
| ?>
| </body>
| </html>
|
|
| Even if I do it without a table it does not work with the Internet
| Explorer:
|
| http://test.seekware.ch/test/flush-notable.php
|
| PHP code:
| <html>
| <head>
| <?php
| header("cache-control: no-cache");
| header("pragma: no-cache");
| ?>
| </head>
|
| <body>
| <?php
| for ($counter = 0; $counter <= 5; $counter++) {
| echo $counter . "<br>";
|
| ob_flush();
| flush();
| sleep(1);
| }
| ?>
| </body>
| </html>
|
|
| Does someone know a solution which works also with the Internet
| Explorer?
|
| Regards
| Stefan
|
| PS: Both solutions work with Mozilla and Opera.
You could also try the meta+refresh HTML instruction:
<head>
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.htmlhelp.com/">
<META HTTP-EQUIV=Refresh CONTENT="10">
</head>

tells the browser to load http://www.htmlhelp.com/ 10 seconds
after the current document has finished loading. Not all browsers
support this, so authors should provide an alternate means of moving
to the new page where necessary. The Refresh header is sometimes used
for "splash screens" or when a page has moved, but the technique is
not very effective since users may not even be looking at the window
that is to be refreshed. Some search engines penalize pages that use a
Refresh of a few seconds or less.
http://htmlhelp.com/reference/html40/head/meta.html
Aug 4 '08 #4
Stefan Mueller wrote:
Hallo

I'm looking for a solution to display on a web page each second a new
line.
Unfortunately does the following solution not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-withtable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
echo "<table border = '1'>";

for ($counter = 0; $counter <= 5; $counter++) {
echo "<tr><td>" . $counter . "<br></td></tr>";

ob_flush();
flush();
sleep(1);
}

echo "</table>";
?>
</body>
</html>
Even if I do it without a table it does not work with the Internet
Explorer:

http://test.seekware.ch/test/flush-notable.php

PHP code:
<html>
<head>
<?php
header("cache-control: no-cache");
header("pragma: no-cache");
?>
</head>

<body>
<?php
for ($counter = 0; $counter <= 5; $counter++) {
echo $counter . "<br>";

ob_flush();
flush();
sleep(1);
}
?>
</body>
</html>
Does someone know a solution which works also with the Internet
Explorer?

Regards
Stefan

PS: Both solutions work with Mozilla and Opera.
The simplest solution is to have your php generate a page with a
javascript variable loaded with your text. Then have a
javascript program that parses the text (using the current
display width) and updates the display with the additional text
each second. Not trivial and will not work if the user has js
turned off/
Aug 4 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: ß Ø ® G | last post by:
Hi I'm trying to find a free javascript affect that will make the changes from one page to another in a browser look like the page is curling over as if the pages of a book are turning over....
5
by: Rajani | last post by:
Hello, I have a strange problem. I want to check the privilege of the login user on each page and allow to display if has suff. priv. I am storing the privilege is session variable. I am...
0
by: jonathan184 | last post by:
This is part of the perl script. Basically i want to try and get the second line of the error message. Now the whole error which is 5 lines long will come up if i use $Errormsg So basically i...
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
1
by: jmacduff | last post by:
I would like to be able to display page load times within our asp.net application for debugging purposes , I am seeing some random slowness in our application and a load time metric would really...
3
by: phil67b | last post by:
Hello everybody, I have a page rech.php where I'm doing a multi-criteria research Ex. choose your car model, choose your country. After validation of my form, on the same page, the lines will be...
19
by: Samuel Murray | last post by:
G'day everyone I'm trying to find out if there is a way (perhaps using CSS) to let this code: <table><tr><td>One Two Three</td></tr></table> display the same as if the code would have...
9
by: tshad | last post by:
I have a Windows App that is doing some work and then writing a "Now Processing..." line to the status line of the window as well as the Textbox on the form. But the problem is that the work is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.