Page 1 of 1

refreshing...

Posted: Thu Feb 19, 2004 12:22 pm
by Illusionist
OK, i've read up on cron jobs and scheduling tasks and stuff, but none of these seem like they can do what i want. All i want is for a page to refresh only when a new comment is added... Instead of refreshing every 2 seconds, i'd like for it to refresh only when a new comment is added... Can this be done?

Posted: Thu Feb 19, 2004 2:12 pm
by Dr Evil
Someone correct me if I'm wrong, but I would say no.
The only way you can make the page refresh when something happens on the server is using push technology.

For this you would need a Java applet running to check the server

Posted: Thu Feb 19, 2004 2:30 pm
by pickle
Hmm, ya, you'd need Javascript to do this. An ugly way to do it while being invisible to the user is to open up a new window with Javascript. In that window, have some PHP code that checks the DB. If a new comment is added, reload the parent (main) window, which will then go and get the new info. This will, of course, require a second window to be open, but you could put it behind the main window, so as to be invisible, and use yet more Javascript to close down the child window when the parent closes.

Posted: Thu Feb 19, 2004 2:31 pm
by McGruff
Php isn't the best choice for chat but it can be done. I vaguely remember a technique for "silent" refreshing using frames, CSS and possibly js. Something like refreshing an (invisible) frame and then using js to copy the new text into the chat area.

Or something. No links - google should track it down.

Posted: Thu Feb 19, 2004 5:05 pm
by Illusionist
LOL, i think ill try the Java applet way, and i fi can't get it to work that way i'll try to look up some information on what you were saying McGruff. Pickle - no... i dont think thats way i'd ever want to go! thanks though