i need and advice and example, how i can build a function, or something else for displaying a "seen" status, like here on SO (in users tab).I k开发者_StackOverflow中文版now it should be with user reg + log system, and i have already did this, but i need exactly this option...to display seen ...
Hello guys, i need and advice and example, how i can build a function, or something else for displaying a "seen" status, like here on SO (in users tab)
Check out:
- Pretty Date by John Resig
Examples:
prettyDate("2008-01-28T20:24:17Z") // => "2 hours ago"
prettyDate("2008-01-27T22:24:17Z") // => "Yesterday"
prettyDate("2008-01-26T22:24:17Z") // => "2 days ago"
prettyDate("2008-01-14T22:24:17Z") // => "2 weeks ago"
You wouldn't only use PHP, you would need a database(like MySQL) to store the state, such as seen. You would most likely want to set up a many-to-many table such as:
Seen Table(id, user_id, post_id)
It is many to many because:
A user can see many posts, and a post can be seen by many users.
精彩评论