Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

102 users online



New Threads/Posts Marker

New Threads/Posts Marker

Currently viewing this thread: 1 (0 members and 1 guests)


SilveR

SilveR

me = me != you
Status: Offline!

New Threads/Posts Marker

I'm coding custom script and I want to display a different icon beside posts that have not yet been read by the individual.

I've thought about this for some time now and all the solutions I came up with were long and complicated. Does anyone have any suggestions on make this easier?

___________________

VertiHost Internet Services
Signup now and recieve a free domain!

Last edited by SilveR, June 24th, 2004 10:47 PM (Edited 1 times)

Adam

Adam

Status: Offline!

what are you thinking of doing?

___________________


Current Project: LivermoreMuscle.com
Sig Hosted by Motorspin

SilveR

SilveR

me = me != you
Status: Offline!

I'm making a ticket system for our companies use, but I want it to show which tickets are new and which tickets are not for individual users.

___________________

VertiHost Internet Services
Signup now and recieve a free domain!

jamiem

jamiem

Flying by the Seat of my Pants.
Status: Offline!

This method would add a massive table to your database.. but here goes.

you could create a new table called 'read' in that you would have 2 fields, the userId and the postId.

When a user click on the post, their userId would be added to the corresponding postID.

To determine if a user has viewed the post you could have a loop/array where all the userId's accociated with a post were read into an array (or the latter) if the users was already there, then show a certian image and vice versa.

I am sure there is an easier way of doing this, but after mulling it, this sems the easiest... if this was on a large scale you might want to have a time limit set up, so as if the post if a month old then the postId and userId would be removed from the 'read' table and a different image was shown...
This would take care of handelling a huge database table....

Good luck with it!

-- Edit--
If it is a ticket system then this is probably not the best way to go!
----------

___________________

J

SilveR

SilveR

me = me != you
Status: Offline!

I was thinking about that, but the huge database table threw me off. It won't be very efficient that way, especially with multiple users and a couple thousand tickets per month.

How do the big forums do it? Like vBulletin and phpBB?

___________________

VertiHost Internet Services
Signup now and recieve a free domain!

jamiem

jamiem

Flying by the Seat of my Pants.
Status: Offline!

Cookies... i think, they do it from the date on the cookie.
the cookie is created when you enter the site, then when you come back to it, the date is read from the cookie file on your computer, and any posts made after that date are given a different image...

But if it is a ticket system, then surley only one user will be viewing them... so when a user click on it, you could have PHP change a value in the database from 'unread' to 'read'. that would work on individual posts!

___________________

J

Rad

Rad

thinking of something witty to put here
Status: Offline!

I've found the best way is to store the current time for the user every 5 minutes or so, then declare every post that has a greater time than the stored time as a new post, and the rest as old posts. When a user reads a post, you store it's id and show it as read to the user. On the next time you store the time, you also erase all of the records of read posts. This isn't 100% reliable, but it is the best compromise to keep database tables from getting rediculously large.

v3x0rg

v3x0rg

Pawn Coder
Status: Offline!
PHP:

<?php
$result 
mysql_query("SELECT * FROM table WHERE id='$tid'");
while (
$row mysql_fetch_assoc($result))
{
    
$status = (!$row['read']) ? '<img src=unread.gif>' '<img src=read.gif>';
    
$status = ($row['replied']) ? '<img src=replied.gif>' $status;
echo 
"$status";
}
?>

___________________

- Moderator at the official AMX Mod X forums

Kickboy

Kickboy

Neverside Newbie
Status: Offline!
Quote:

Originally posted by blue44
Cookies... i think, they do it from the date on the cookie.
the cookie is created when you enter the site, then when you come back to it, the date is read from the cookie file on your computer, and any posts made after that date are given a different image...

Actually most systems use both methods -- Cookies and Database. Hence the "Browse board with cookies" option you see in most BB prefs.

___________________

I don't suffer from insanity; I enjoy every minute of it.
Unintended Theory | Cacrew v4

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0085 seconds.