php - Facebook-Like Activity Stream -


I wrote an application, this is not a social networking script by any means, but for my script "user profile" And I am interested in the idea of ​​SQL / PHP design to know about the activity streams seen on Facebook for users of my script.

Such activities like "Joy commented on X's wall." Or "joi, x, foo your picture" or "foo changed their photo [photo here]"

I want this to be dynamic, not on stationary entries, because if Joey uses his name Something else changes, I do not want to show this old data.

Therefore, if you please, please help me with the design of this ... I do not need any code, just push directions on the right.

Thanks a lot!

I'm sure that your proposed schema will give you a lot of flexibility:

What do I want DB Schema? I was probably thinking about something like this ... activity_id activity_message activity_time where the message "{USERID: 34} likes {USERID: 23} posts" and "{USERID: 34}" will change the picture of it {PHOTOID: 2 } "

With this problem, you are relying on ways to parse regular expression and other expensive (in time) performance.

Perhaps (I have never had to design this type of thing practically) if you have a choice for "choice" In which user.id, post.id, timestamp, you can easily calculate the number of people who like it for a particular post. Activity Stream You can filter the time and time by the user. The stored user.id is the person who liked the post and you can join the post.id to get the user from that post.

In order to deal with the pictures and / or other interactions in it One The table can be, user.id, item.id, verb, timestamp, where item.id is a photo / post / other id reference and action is a numerical identifier that is related to the action that you then add to the string You can.

You have other advantages to doing things this way, if you later want many languages ​​or decide to change the word "pleasure" of "happiness", then you can do it easily You can store where you have stored a text string that will be displayed later, you will have more difficulty in changing it.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -