tags:

views:

64

answers:

2

Hello once again,

I'm doing an auctions website (not for any institution, just as part of my learning of php and cakephp). At Home page I have all the items displayed. What I need to do now is to refresh price / last licitation and time remaining in each item when any user makes a licitation.

So do you know how can I, in a view, keep watching licitations table for new records and then update those values in the view?

Attention: The new record in the database can be inserted by any other user.

Thanks.

+1  A: 

You will have to use JavaScript to ask the server (your PHP script) if there are any changes, and then do the updating. You could use Comet for this. In short: Comet is a "technology" that allows you to be connected to the server constantly so that the server can send data to the client when said data is available (without the need to refresh a page).

Jan Hančič
Going to explore Comet, thank you ;)
NoOne
To use comet in this, should I run php as fastcgi?
NoOne
Look at some Comet implementations like http://www.ape-project.org/home.html and http://meteorserver.org/ that should get you started
Jan Hančič
I'm sorry I read somethings about ape and meteor and they seem to be frameworks / servers that can do 'long polling' but your suggestion is to use them? Or just use comet? Cause I'm having some troubles to integrate these things with cakephp :X
NoOne
Comet is just a name for set of technologies. Ape and Meteor are implementations of Comet. You need a Comet server and that is what Ape and Meteor are.
Jan Hančič
A: 

You can either continuously refresh the page, or you can use AJAX to poll the server for changes and then update the page data. There is no good way to have the server notify the page directly - the page will have to ask about changes.

Scott Saunders