AbydosGater Posted November 27, 2009 Share Posted November 27, 2009 Hi, I Hope I do have the right section for this! I am currently working on a GWT Based AJAX Application with a PHP/MySQL backend. One of the features I wish to add to my application is a forum for the users. My query is to how forum systems such as phpBB, SMF, or vB implement the "unread topics/posts" feature. EG: When I visit this forum and open a board such as this Application Design section, the forum knows which topics I have or have not read. I was wondering how this was implemented? The first thing that came to my mind was that every time a user opened a topic, a row was inserted into a db table that recorded the users id and topic id that could be checked against later. But surely having a list of every topic the user has viewed and checking against it is a very unefficient method? Is there another way to accomplish such a task? Also, what would happen if a change was made to a topic, such as a new post? Would the forum need to loop through every record of every users visit to a topic and if the user has visited this topic remove the record so that it appears as unread to the user? Any advice? Thanks, Andy Quote Link to comment https://forums.phpfreaks.com/topic/183072-forum-posts-database-design/ Share on other sites More sharing options...
isedeasy Posted March 5, 2010 Share Posted March 5, 2010 I know this is an old thread but I would also like to know how this is achieved. Quote Link to comment https://forums.phpfreaks.com/topic/183072-forum-posts-database-design/#findComment-1022003 Share on other sites More sharing options...
roopurt18 Posted March 5, 2010 Share Posted March 5, 2010 The OP probably has the method right. As far as efficiency is concerned you'll notice that the "unread topics" only lists 3 pages of topics, i.e. the current day's topics. It doesn't list every topic ever posted. There is probably a cron job to remove entries from this table every day at midnight or something. Quote Link to comment https://forums.phpfreaks.com/topic/183072-forum-posts-database-design/#findComment-1022043 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.