display image on new thread and updated
Moderator: General Moderators
display image on new thread and updated
i would like to know how to build logic on displaying an image when there is a new topic/thread, upon visiting it again, it will disappear, but when the there is a reply, or the message is updated, the image showing that there is a new message or there is a reply, will appear again.....
thanks
thanks
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Pseudo-SQL
Pseudo-PHP
I hope i am able to make myself clear now 
Code: Select all
SELECT topic,posttime,viewtime,replytime from postsCode: Select all
if(viewtime == 0 || viewtime < replytime) echo "<img src='newpost.gif'>{$topic}" //if not viewed or viewed before a reply was made, then show "new-post" image
else echo $topic //if viewing same post again, dont show image ;)- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
a seen field doesn't work well with multiple users.
You can store the "seen" data in a seperate table with the thread or post ids as the link to the posting system. When they are logged out, all their seen data is erased. The logic is, if it's not in the seen table and the thread/post has updated since they were last on.. they see a "new" indication. Otherwise, it's been seen previously so ignore.
it's also storable in a cookie, but limited in quantity.
At any rate, you may want to store the timestamp of when they last saw it new.
You can store the "seen" data in a seperate table with the thread or post ids as the link to the posting system. When they are logged out, all their seen data is erased. The logic is, if it's not in the seen table and the thread/post has updated since they were last on.. they see a "new" indication. Otherwise, it's been seen previously so ignore.
it's also storable in a cookie, but limited in quantity.
At any rate, you may want to store the timestamp of when they last saw it new.
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
thanks for the posts guys...i have here tables for posts and comments, i have done the sorting part of it, when someone posts, it is sorted by date DESC, as well as when someone comments.where do you think should i link the visits table?cause my idea here is, when someone posted a comment, the image will appear, otherwise, not.and i want to keep focus on the comments side....thanks for your time guys. 