First, you need a table in your database. My table is pretty simple, defining three elements -- an ACTION, an ENTITY and an ELEMENT. I know these are vague, and that's intentional. I want several actions around the site to be visible on the spy page, and I want them to be represented sensibly. For example, to show a user logging on, we have ACTION="logged in", ENTITY=username and ELEMENT=users_logo. As another example, when a user comments on another user's photo, ACTION="left comment", ENTITY=username (commenter) and ELEMENT=img_thumnail. You get the idea.
Once the table is built, there's the matter of inserting new rows into the table on certain actions. This is simply a matter of creating a function in your func.php file (or wherever you keep your functions) and calling it after certain actions occur.
Now, on to the AJAX part. First of all we need to decide how many rows of the table we want to show on the spy page. I chose 20. We'll want to prune the table occasionally, since we really don't need any more than 20 rows in there at any time
Read Full Tutorial...
|
Rate this Ajax Tutorials
Rating: 7.9 out of 21 votes cast
| |
|