如何显示论坛帖子的未读/读状态像vbulletin,phpbb,其他? [英] How to show unread/read status of forum post's like vbulletin, phpbb, others?

查看:343
本文介绍了如何显示论坛帖子的未读/读状态像vbulletin,phpbb,其他?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是百万美元的问题,我看到它的时间和时间在这里和其他php编码相关的网站和论坛,但我从来没有看到一个答案。



所以我开始挖掘并研究一些大流量论坛如何完成这个功能,显示哪些线程中有新的未读邮件,它们似乎存储将线程ID号转换成用户cookie。所以,会有一个cookie,你在一定时间内读取的每个线程的线程ID。或类似的东西。



然后,我在这里读到cookie只能存储X个字符,所以我想知道一个cookie可以存储多少数据?

解决方案


如果我有一个5-6个字符的ID号,更重要的是,cookie规范说,浏览器只需要接受每个域20个cookie。这个限制由Firefox增加到50,由Opera增加到30,但IE6和IE7对每个域实施了20个cookie的限制。超过此限制的任何Cookie都将淘汰旧的Cookie,或被浏览器忽略/拒绝。


取自此作者的帖子



我相信论坛帖子的未读/读状态应该通过数据库完成。我在网上找不到示例,但我已阅读PHP和MySQL Web开发(第4版) ,他们有一个专门用于开发自己的论坛页面的部分。他们提供示例代码并解释启动它的过程。


This is the million dollar question, I see it time and time again on here and other php coding related sites and forums but I have NEVER seen an answer to it.

So I started digging in and studying how some of the big high traffic forums accomplish this feature of showing you which threads have new unread posts in them and it appears that they store the thread ID number into a user cookie. So there would be a cookie with a thread ID of every thread you have read within a certain amount of time. Or something similar to this.

I then read on here that cookies can only store X amount of characters, so I am wanting to know how much data can be stored in a cookie? If I have a 5-6 character ID number, how many could I fit into a cookie?

解决方案

More importantly though, the cookie specification says that browsers need only accept 20 cookies per domain. This limit is increased to 50 by Firefox, and to 30 by Opera, but IE6 and IE7 enforce the limit of 20 cookie per domain. Any cookies beyond this limit will either knock out an older cookie or be ignored/rejected by the browser.

Taken from this author's post

I believe for the unread/read status of forum posts should be done through the database. I could not find an example online, but I have read "PHP and MySQL Web Development (4th Edition)" and they have a section devoted to developing your own forum page. They supply example code and explain the process to get it started.

这篇关于如何显示论坛帖子的未读/读状态像vbulletin,phpbb,其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆