Page 1 of 1

Messageboard: How do they do it?

Posted: Sat Jul 20, 2002 8:46 am
by fatalcure
I've created my own messageboard and now im worndering, how on this messageboard, when you leave the forum and come back the next day, it has all the new topics that you haven't read yet w/ a lil ARROW, and once you've read it, the arrow goes away, but only for the one you read.

I thought it would be w/ a lastvisit cookie, and it shows everything posted above that time, but that wouldnt work too well if you wanna make it work like this forum.

Im pretty sure this forum uses Sessions for this, but how are they used? are there session variables assigned for each topic above the time of last visit and then the session variable is destroyed after you view the topic??

I've never worked w/ sessions b4, but if thats how its done, i'll look into it.

If there's another way of doing this, let me know as well.

THanks

Posted: Sat Jul 20, 2002 3:33 pm
by lc
actually I think it is indeed cookies.

Posted: Sun Jul 21, 2002 12:05 am
by MacDaddy
It's usually an extra field in the db

Posted: Sun Jul 21, 2002 5:57 am
by twigletmac
Why not grab the source for this board and have a look around in it:
http://www.phpbb.com

Mac

hrm

Posted: Mon Jul 22, 2002 3:06 am
by phice
I made mine in like 2 days ^_^ It's very easy. Although it's about 3:15 in the morning, and I have no sense of what thinking is. :/

Posted: Mon Jul 22, 2002 9:38 am
by fatalcure
uhm, how'd u do it?

Posted: Mon Jul 22, 2002 9:48 am
by BigE
Its just a field in the database. I've looked at the source for these forums before and I remember thats how they do it. They take each post ID and save it into a field in the DB that is in the user table. They separate every ID by a comma or something so they can split it in the code. Hope that helps.

Posted: Mon Jul 22, 2002 10:09 am
by fatalcure
hum, I see, I tried looking at the source as twigletmac stated, but it was a lil confusing for me :/

I'll see if i can get to work.

But the thing is, when do they reset the LAST TIME VISITED, like w/ this forum, if you close the browser and come back an hour or so later, it'll have all the new posts listed, then (without looking at any of the new posts), just close the browser again and come back to the forum, they're gone and the lastvisit time is set to the current time.

Am i making sense?

Just wondering how they did that...

Posted: Mon Jul 22, 2002 12:20 pm
by BigE
Thats a fairly easy one too. When a link is clicked, and a page is loaded, it stores the time in the database. Then when another page is called, if that time is so many minutes ago, then it says "hey, this person left for a while, so lets add all posts that are between that time, and so many minutes after that time to the 'read' pile". Thats kinda the basic idea of how it all works... peicing it together with code will be your part :D Have fun :wink: