Page 1 of 1

Forum & new posts function

Posted: Mon Aug 13, 2007 2:01 pm
by KalleL
Okay, i've been developing forum app for my use, and now i'm quite ready, though, there is still one problem to be solved. What's the most sensible way to do "new posts" -function. For example, in this PhpBB, there's different colour icons on the left, depending whether or not there's new posts in topic.

I've tried to google this, but i think i'm using stupid keywords for searches. So, please, can someone help me?

Regards,
Kalle

Posted: Mon Aug 13, 2007 2:04 pm
by superdezign
Save both their last login and the previous-to-last login and check against the previous one for new posts.
For topics being read or not, just make it so that when they have read the topic, you add that topic to the session array.

Posted: Mon Aug 13, 2007 6:21 pm
by iknownothing
The easiest way would probably be within your while statement.

Eg.

Code: Select all

while($row = mysql_fetch_array($result){
     if($user_last_login < $post_last_reply){
          echo '<img src="newpost.gif">';
          //OTHER STUFF
     }
     else{
          echo '<img src="oldpost.gif">';
          //OTHER STUFF
     }
}