Forum & new posts function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KalleL
Forum Newbie
Posts: 12
Joined: Mon Apr 30, 2007 8:52 am

Forum & new posts function

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post 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
     }
}
Post Reply