duanhongxian6982 2012-04-28 05:15
浏览 32
已采纳

已经阅读了帖子

I am working right now on a forum and I'm almost done, but now I came to a point where it kinda got difficult.

You're probably familiar with the phpBB forum. There's this cool feature which flags posts as read and unread.

I found here a similar thread about this, but I didn't really get the solution.

If I save the time when the user logs in and mark all posts which have been created in the past, it might work. But now, what's next? The user read an unread post and I want to mark it as "read" but the other posts should still stay flagged as "unread" until he reads them. I kinda have to store this data, don't I?

And I've actually been also thinking about saving that data in cookies. How about that?

  • 写回答

2条回答 默认 最新

  • duanrou5680 2012-04-28 07:54
    关注

    You should have a table with a many-to-many reltaionship:

    marked_as_read
    --------+--------
    user_id | post_id
    --------+--------
    

    Remove any posts older than (say) 30 days, to keep the table under hysterical size.

    In your PHP code, mark any posts not present in this table AND are younger than 30 days as not read. When an answer is read, place it here.

    When a post is edited/updated, remove it from all users in this table.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程