PDA

View Full Version : Total Views For Forum


SystemLogic
07 Mar 2001, 16:24
How would I setup the total views for the entire forum? I would think it would be some sort of mofication of this code which I found in index.php:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I tried playing around with it a little, but couldn't figure it out.

Can anybody help me out? It should be an easy hack, but not positive.

07 Mar 2001, 16:45
If you want to count all the posts for a single forum, use this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and if you want to count all the posts for the entire board, use this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Hope this helps.

07 Mar 2001, 16:51
Oops, I just noticed that you said that you wanted total ~views~ so here is the code for that:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

07 Mar 2001, 16:57
Kier, he wants total views not posts but think it will be based on posts, which it will not :) because views are stored in the thread table so you would have to add all the views for every thread together.




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Now:

i) i think that will work but i have not tested it
ii) i would also think it is quite server intensive as it has to go through every single thread to count up. I can't see any other way of doing it bar having a counter increase every time a thread is viewed at the same time the thread count is increased. That would be possible and perhaps less server intensive in the end.
iii) if it does not work tell me, someone will probably post glaring errors.

07 Mar 2001, 16:58
ar.. kier re posted and that looks a far far better way of doing it, something new to learn :)

07 Mar 2001, 17:00
Hehe, I've never actually used the mySQL SUM() function before, but i figured it might exist/work, and it did! Now to go back to my site and do some optimising :rolleyes: ;)

07 Mar 2001, 17:33
All I have to say is shweeeeeeeeeeeeeeet

You da man Kier!

Ninboy
25 May 2001, 23:21
Oks, where say

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


In the thread.forumid=\"$forumid\""); I need to put the forum id?

eva2000
25 May 2001, 23:29
Originally posted by Ninboy
Oks, where say
In the I need to put the forum id? a releeased hack is here http://vbulletin.com/forum/showthread.php?s=&threadid=14739