Garethp Posted December 31, 2010 Share Posted December 31, 2010 So, you know how on forums (including this one) the icon of a topic/forum will be greyed out if your account viewed that topic's latest post, regardless of which computer you viewed it on? How exactly does it store that? I know that logically it would store it on the Database, but I'm curious as to the actual implementation. It seems to me that storing every single topic you viewed it and when would take up huge numbers of rows, even for a small number of people, like say 100. If you have a forum with 1000's of people, each viewing even 3 topics a day, you're record numbers would be huge, slowing down the database. And calling your last viewed time for each and ever topic? Wouldn't that slow down the code excecution heaps? If you have any input, I'd love to hear it. It's a question I've been wrestling with in the back of my mind for a few years now Link to comment https://forums.phpfreaks.com/topic/223065-forums-topics-viewed/ Share on other sites More sharing options...
BlueSkyIS Posted December 31, 2010 Share Posted December 31, 2010 i would download the source code of a forum and look at it to see what it's doing. Link to comment https://forums.phpfreaks.com/topic/223065-forums-topics-viewed/#findComment-1153331 Share on other sites More sharing options...
the182guy Posted January 3, 2011 Share Posted January 3, 2011 Here's one way: Create a table that will basically store the last activity timestamp of a user for a thread and forum like: threads_viewed ------------------------ user_id thread_id timestamp For the logic: each time a thread is viewed, insert a record into that table. Now you know the last time the user viewed the thread. So all you have to do to show a 'new' icon on the thread list is just check if there any posts to the threads where the post time is after the users last thread view time, that way you know that the user has not viewed those replies. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/223065-forums-topics-viewed/#findComment-1154138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.