Refresh a page in continuous mode ...

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Sun Sep 05, 2004 2:47 pm

Hello all

I am writing a Chat script,
I need a page to be refresh in Continuous mode ,
I can refresh a page using META but id doesnt like so good !
It will rewrite the page with flickering and some weird stuff ...

so any idea how can I refresh my page Continuous without
any problem ?

or please give me idea about how to refresh a CHAT PAGE ...

I appreciate that

Alex
New php-forum User
New php-forum User
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm
Contact:

Sun Sep 05, 2004 4:48 pm

I believe that i answered a similar post before, but i'd have to check...
there are many ways you can do this, meta tags are not the best, but other ways tend to require JS or DHTML. I would take a working Chat script from here and use it instead of reinventing the wheel... but if I really wanted to write my own, I would still take a look at one of the scripts, just to get an idea of how others do it. Oh, i think you can use header() function in a very creative way to reload...

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Mon Sep 06, 2004 10:07 am

Thanx a lot for your answer
but I would like to write my own
as I want to use this chat room in
a commercial web site so I cannot
user these free GPL chat rooms ...

Ive seen a chat room called VOODOO
in the web site you gave me on this address :

http://demo.vochat.com/

it has a Continuous mode for refreshing page
but I cannot find its command in their PHP files

can U help me on this plz ?

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Tue Sep 07, 2004 2:06 am

Code: Select all

<html>
<head>
<?php
include("inc_common.php");
set_variable("url");
echo "<meta http-equiv=\"refresh\" content=\"0;URL=".$url."\">";
?>
<body>
<a href="<?php echo $url; ?>">press</a>
</body></html>


That is in the 'go.php' file - seems to be all that get's it to refresh as far as I can tell.

Hope that helps

Andrew

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Tue Sep 07, 2004 6:08 am

WoozyDuck wrote:as I want to use this chat room in
a commercial web site so I cannot
user these free GPL chat rooms ...


You have a fundamental misunderstanding of the GPL.
Image

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Thu Sep 09, 2004 2:42 pm

bezmond wrote:

Code: Select all

<html>
<head>
<?php
include("inc_common.php");
set_variable("url");
echo "<meta http-equiv="refresh" content="0;URL=".$url."">";
?>
<body>
<a href="<?php echo $url; ?>">press</a>
</body></html>


That is in the 'go.php' file - seems to be all that get's it to refresh as far as I can tell.

Hope that helps

Andrew


HI mate

thanx a lot for your answer
Well this file contains a like of code which is a META for refreshing
the page , Ive tried using the same META , like refreshing the
page every 2 seconds , but it gives me a lot of flickerin!

I have another idea , can I read the chat content in an hidden frame
and then write the changes to my main frame ?
in this case I will need a command to re-write a content in
an HTML page , can we do this anyway ?

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Thu Sep 09, 2004 2:43 pm

swirlee wrote:
WoozyDuck wrote:as I want to use this chat room in
a commercial web site so I cannot
user these free GPL chat rooms ...


You have a fundamental misunderstanding of the GPL.


Thanx
your right
I dont know anything about GPL ...
could you please direct me to a page or something
which I can read about this copyright ?
I appreciate that

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Thu Sep 09, 2004 3:06 pm

An easy way of creating a Chat script is by using a file to store the 10 or 20 last messages in, and reading it on an iframe every 4" using the META Refresh function. The page stays static and the iframe keeps refreshing with new posts
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Thu Sep 09, 2004 3:07 pm

The GPL is a license, not a "copyright." And the first result for GPL on Google is the official GNU copy of the GPL, which is as well as you're apt to do for information about the GPL.
Image

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Thu Sep 09, 2004 7:05 pm

mike wrote:An easy way of creating a Chat script is by using a file to store the 10 or 20 last messages in, and reading it on an iframe every 4" using the META Refresh function. The page stays static and the iframe keeps refreshing with new posts


Thanx a lot mike
I can do that , but that iFrame will flick as well
the place I like to show my messages ,
actually I do the same , I keep messages in a file
and read it from server every few seconds and
load it to the chat page ,
but everytime I load the page , it goes on the top
and I have to scroll it via script to the bottom ,
so it flicks a lot specially in Netscape ,
can we add some text in bottom of the page dynamic ?

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Thu Sep 09, 2004 7:06 pm

swirlee wrote:The GPL is a license, not a "copyright." And the first result for GPL on Google is the official GNU copy of the GPL, which is as well as you're apt to do for information about the GPL.


Thanx a lot swirlee
I got it
:)

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Fri Sep 10, 2004 12:13 am

Hmmm I forgot to write down this trick :D

Code: Select all

<body leftmargin="0" topmargin="0" onload=window.scrollTo(0,99999);>


And also, if you want the newer messages shown from bottom to the top use something like this:

Code: Select all

$messages = file("data.txt"); 
$messages = array_reverse($messages);
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Fri Sep 10, 2004 5:13 am

Thanx mike
I use this command to scroll window to the bottom :

Code: Select all

 document.body.scrollTop = document.body.offsetHeight;


but I will try urs as well ,
I hope this time window doesnt flick anymore.

Cheers

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Fri Sep 10, 2004 1:52 pm

There are much more you should also do for your chat... think what will happen if someone will post a 100-character-long word like this:

"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

The table/frame will be streched out! You can make a small function cutting down long words
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Fri Sep 10, 2004 2:11 pm

that is right
Ive sort that out , I sort out everything about user's characters
but my problesm is just refreshing the page :( which is aweful !

Ive found a JavaScript function to RE-WRITE a content on the page !
here :
http://www.howtocreate.co.uk/tutorials/ ... tediv.html

I am working on it how can I control that iFrame from another page frame
like I have 2 frames for my chat page , the one who users types in,
and another one which is for showing the messages !

with re-writing idea I think I can refresh the content on the page only
instead of refreshin the whole of it , that would be nice , isnt it ?

but I dont know yet how can control an iFrame from outside a frame ,
please take a look at the link Ive given before and help me about
this if you can.

Regards

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Sun Sep 12, 2004 6:36 am

Hmm easy :-D

put the following java thing into the page containing the "form" for posting messages. Assume that your frame or iframe is named as "msgbox" and its html source is "msgbox.php" eg:

<iframe name="msgbox" src="msgbox.php" width="110" height="150" noresize frameBorder=0>

So every time a message is posted, the page is reloaded showing the new post!

Code: Select all

<SCRIPT>
<!--
function reload() {
top.msgbox.location="msgbox.php";
}
//-->
</SCRIPT>
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Mon Sep 13, 2004 8:05 pm

Thanx a lot mike for the answer ...
but I still have some problem :(
Sorry I am a newbie ...

here is my code for TOP frame (main.htm):

Code: Select all

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

<p align="center">

<iframe name="msgbox" src="http://www.google.com" width="505" height="276" noresize frameBorder=0>

</body>

</html></p>



and the code for bottom frame (menu.htm) :

Code: Select all

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV=Refresh CONTENT="3; URL=menu.htm">

<title>New Page 3</title>
<base target="top">

<SCRIPT LANGUAGE = "JavaScript">
<!--
function reload() {
top.msgbox.location="http://www.yahoo.com";
}
//-->
</SCRIPT>

</head>
<body onload="reload()">

<p>THIS PAGE WILL RELOAD THE TOP FRAME!</p>

</body>
</html>



and here is the source for FRAMES PAGE file (index.htm) :

Code: Select all

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<frameset rows="*,59">
  <frame name="top" src="main.htm" scrolling="auto">
  <frame name="footer" scrolling="no" noresize target="main" src="menu.htm">
  <noframes>
  <body>

  <p>This page uses frames, but your browser doesn't support them.</p>

  </body>
  </noframes>
</frameset>

</html>



It doesnt work !
Could you please tell me what I am doing wrong with this code ?
I really appreciate that

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Mon Sep 13, 2004 8:27 pm

I've found the problem !
We should add a parent. word in to the begining of the command :

Code: Select all

parent.top.msgbox.location="http://www.yahoo.com"; 


it works now ,
:-D

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Tue Sep 14, 2004 1:30 am

Perfect :)
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Tue Sep 14, 2004 4:40 am

mike wrote:Perfect :)


no , your help was perfect ,
I appreciate that
:)

Post Reply