|
-
Oct 11th, 2008, 12:57 AM
#1
Thread Starter
WiggleWiggle
Thread Views
I have been holding this off for quite some time.
I am not sure how to do Thread Views for my forum. My thought is to have a table with either IP address (or usernames) and the forumID (along with timestamp, i guess) and then when i want to display the views, i just query all the records for that forum.
It seems like that table could get really big, really fast. Is there any other way to do it, or am i right on the money?
My usual boring signature: Something
-
Oct 12th, 2008, 06:45 PM
#2
Re: Thread Views
Usually just a counter field which you increment.
-
Oct 12th, 2008, 09:20 PM
#3
Thread Starter
WiggleWiggle
Re: Thread Views
 Originally Posted by penagate
Usually just a counter field which you increment.
but that would increase every time someone clicked the link, replied to a thread, edited a thread, delete a post.
My usual boring signature: Something
-
Oct 12th, 2008, 11:33 PM
#4
Re: Thread Views
Yeah, usually. They tend not to be reliable in the least.
The method you suggest (a table with a unique index on thread ID + IP address) would be more reliable, but also fallible. What about dynamic IPs? What about proxies? The table might get fairly large, but that may or may not be a problem.
Another method would be to store thread ID, user ID, and view count, which a unique index on thread ID and user ID and counting guests as user 0. This would allow you to track who viewed the thread and how many times they did so.
MySQL SUM() may or may not be cached (I forget) so you could also store a total number of views against the thread record if performance is a concern; display that, then provide an option to drill down to views against users.
(Sorry, I wrote this when I read your reply, then went to lunch and forgot about it.)
-
Oct 12th, 2008, 11:49 PM
#5
Thread Starter
WiggleWiggle
Re: Thread Views
 Originally Posted by penagate
Yeah, usually. They tend not to be reliable in the least.
The method you suggest (a table with a unique index on thread ID + IP address) would be more reliable, but also fallible. What about dynamic IPs? What about proxies? The table might get fairly large, but that may or may not be a problem.
Another method would be to store thread ID, user ID, and view count, which a unique index on thread ID and user ID and counting guests as user 0. This would allow you to track who viewed the thread and how many times they did so.
MySQL SUM() may or may not be cached (I forget) so you could also store a total number of views against the thread record if performance is a concern; display that, then provide an option to drill down to views against users.
(Sorry, I wrote this when I read your reply, then went to lunch and forgot about it.)
i will try your method out.
seems a little more reliable.
I will also do some research on how phpBB and vB do it, maybe i can get some ideas.
My usual boring signature: Something
-
Oct 13th, 2008, 12:18 AM
#6
Re: Thread Views
I can tell you now that they just use simple incrementing counters.
-
Oct 13th, 2008, 01:30 AM
#7
Re: Thread Views
My quick thought is...
If IP + Session ID are unique (query a db perhaps), then count++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|