Refresh a php chat window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ampersand
Forum Commoner
Posts: 54
Joined: Thu Nov 28, 2002 2:00 am
Location: Norway

Refresh a php chat window

Post by ampersand »

Is there another way to refresh the chat window than using javascript or meta tags?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Sure.

Code: Select all

<?php
?>
<meta http-equiv="refresh" content="5; url=<?php echo $_SERVER["PHP_SELF"]; ?>"> 
<?
?>
Must be in the <header> tag and also you might want to change the refresh intervals.
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

That way works but the problem is if you have a heap of posts in your chat page, it has to load all over again and it could take a while or longer on a slower internet connection.

Anyone know of a better way?
Gleeb
Forum Commoner
Posts: 87
Joined: Tue May 13, 2003 7:01 am
Location: UK
Contact:

Post by Gleeb »

WAP chat rooms generally just wait for user input for it to refresh. Lame, IMHO, but it works.
ampersand
Forum Commoner
Posts: 54
Joined: Thu Nov 28, 2002 2:00 am
Location: Norway

Post by ampersand »

I'm now using this in my "shoutbox/chatbox". Showing only 15 lines..
Post Reply