开发者

Seen function, like here on SO [closed]

开发者 https://www.devze.com 2023-02-17 01:01 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消