Goose87 Posted January 3, 2009 Share Posted January 3, 2009 Hi all, I am writing a custom forum as I need it to fit inside my website. Anyway, to cut a long story short, I can't seem to crack the logic behind a system within every other forum: How do I show the new posts that have been updated since the last visit EFFICIENTLY?? I can think of lots of really inefficient ways to do it, but I can't seem to crack the logic behind it. If anyone could point me in the right direction, as plain answers never help anyone learn, i would greatly appreciate it. Kind Regards, Goose. Link to comment https://forums.phpfreaks.com/topic/139270-forum-logic-problem/ Share on other sites More sharing options...
hobeau Posted January 3, 2009 Share Posted January 3, 2009 Hi Goose87, Posts in a forum are saved in rows that have a column of a date time stamp. When you log into a forum the time you last logged in is saved in your user table and that date/time is saved to your session. When you go to the list of posts in a forum, the date time stamp in your session (which was the last time you logged in) is compared with the post date time stamp. That should do it. Link to comment https://forums.phpfreaks.com/topic/139270-forum-logic-problem/#findComment-728489 Share on other sites More sharing options...
Goose87 Posted January 3, 2009 Author Share Posted January 3, 2009 Thanks for the reply hobeau. I understand what you've written, but i came to that conclusion beforen and hit a snag: How do I know which posts they've seen and which ones they haven't? i.e. you log in at X A post is made at Y You see that post, Y > X, therefore display it's new. But, what about the following: you log in at X. Post Y is made. Post Z is made shortly after. You view post Y. Do i update the timestamp for the user then? If I don't, then the post will keep showing as NEW. If I DO update it, then Z won't show up as new. That's what's really got me Link to comment https://forums.phpfreaks.com/topic/139270-forum-logic-problem/#findComment-728490 Share on other sites More sharing options...
DarkSuperHero Posted January 3, 2009 Share Posted January 3, 2009 maybe try adding and extra session or cookie variable that stores the id's of the post that have been read already ? eg. you log in at X post is made at Y you view Y, the script creates a new Y variable....saying it has been read.... short there after post Z is made....and looks new, because there no new Z variable..... inefficient ? :-( Link to comment https://forums.phpfreaks.com/topic/139270-forum-logic-problem/#findComment-728495 Share on other sites More sharing options...
Goose87 Posted January 3, 2009 Author Share Posted January 3, 2009 Has anyone else got a view on this one? I'm not sure if the session one is efficient or not, so I need someone else to give a view on the matter. Many Thanks. Link to comment https://forums.phpfreaks.com/topic/139270-forum-logic-problem/#findComment-728614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.