显示用户未读的话题或帖子

发布于 2024-11-15 07:53:43 字数 135 浏览 3 评论 0原文

我正在编写自己的基本论坛以插入到 code igntier 网站中。我对如何显示用户未读的线程/最新帖子有点困惑。

我正在考虑一个表来保存访问的每个 thread_id,但该表有可能变得相当大。

有哪些方法可以满足这一要求?

I am in the process of writing my own basic forum to plug into a code igntier site. I'm a little stuck on how to display threads/latest posts unread by a user.

I was thinking of a table that holds each thread_id visited, but this table has the potential to get rather large.

What's are some ways to approach this requirement?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦里兽 2024-11-22 07:53:43

一个简单的想法:记录用户访问站点/论坛/子论坛的最后日期时间。根据您的喜好,这可以像线程或子论坛一样精细。也许在 cookie 中创建/更新这个 thread_idlast_visit_date 键值对。也许将其存储在 cookie 中,而不是存储在 RDBMS 中。问:这是任务关键数据,还是能够/不能承受数据丢失的重要功能?

当用户返回时,查找 create_date 大于论坛 last_visit_date 的所有主题/帖子。

我假设访问论坛(线程列表)的行为与“查看”相同。假设如果提供了信息,则您已“查看”了线程标题,无论您是否实际深入了解了该线程。

A simple idea: record the last datetime that a user visits the site/forum/subforum. This could be as granular as the thread or subforum, as you like. Perhaps create/update this key-value pair of thread_id and last_visit_date in a cookie. Perhaps store this in a cookie, rather than in your RDBMS. Ask: is this mission critical data, or an important feature that can/cannot withstand a loss of data?

When the user returns, find all the threads/posts whose create_date is greater than the last_visit_date for the forum.

I'm assuming that the act of visiting the forum (list of threads) is same as 'viewing'. Assuming that if the info was presented, that you'd 'viewed' the thread title, regardless of whether you actually drilled into the thread.

对风讲故事 2024-11-22 07:53:43

最简单的方法可能就是保留用户上次访问时间的 cookie 并查询此后发布/编辑的帖子。您无法完全获得所有已读线程,但大多数论坛似乎都是这样工作的,否则您必须将所有已读线程保存在某处。

The easiest way out would probably be just to keep a cookie of the time of user's last visit and query posts posted/edit after this. You don't get exactly all read threads but most forums seems to work this way, otherwise you have to save all read threads somewhere.

独木成林 2024-11-22 07:53:43

我认为您确实不需要像您想象的那样创建任何表来记录线程 ID,因为它会随着用户规模和创建的线程/帖子的数量而增长。您可以仅将用户上次访问后创建的话题或帖子显示为未读。我想这就是我要做的。

I don't think you really need to create any table to log thread ids as you have thought because its going to grow by the size of your users and by the numbers of threads/posts created. You can just show threads or posts that were created after the user's last visit as unread. I think thats what I am going to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文