View Full Version : [Release VB2] Total Thread Views
SystemLogic
20 Apr 2001, 23:34
This hack was done by Kier, just wanted to post it in its own thread :)
What It Does
Counts all the views for each thread and adds them together. Basically a sum of the pageviews for all of your threads.
How To Implement This
Copy and paste this code into index.php in the regular forum directory.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Then just print $totalviews anywhere you want.
Example: http://www.systemlogic.net/boards on the top left next to the number of posts/threads stats.
bokhalifa
21 Apr 2001, 05:22
good hack min :D
This is a cool little hack, I've just implemented it with no problems other than my own stupidity (I forgot to upload the new index.php -- d'Oh!).
Anyway, after I installed it and looked at it (I put the output on a new line under the thread and post counts), it occurred to me that if you've imported from UBB (as I have), this isn't really a true count. UBB doesn't keep track of thread views, so however many you had while using UBB don't count. Your actual number may be a little higher or much higher; there's no real way to know.
This is not a criticism; I don't mean to rain on this parade. I'm just pointing it out, that's all.
eva2000
21 Apr 2001, 06:35
nice :)
SystemLogic
21 Apr 2001, 18:47
Anyway, after I installed it and looked at it (I put the output on a new line under the thread and post counts), it occurred to me that if you've imported from UBB (as I have), this isn't really a true count. UBB doesn't keep track of thread views, so however many you had while using UBB don't count. Your actual number may be a little higher or much higher; there's no real way to know.
Yup, you're right, but I guess it's a good thing if you're starting over or just starting up using VBulletin. If you're importing into VB from anything else like UBB, it won't convert the thread views.....Just thought it be cool to have for those that wanted it :)
the_sisko
21 Apr 2001, 23:26
Good idea! Thx for repost it as a own thread.:)
great little hack!!
I have added this feature on my forum ^_^
thanks
TimberLand
08 May 2001, 00:29
As far as the ubb missing views, could you add a little saying as of May 7, 2001 or something like that. If so how would I do that?
Dan
where do I insert this at?
what line number?
And what about adding "Thread views since""
Like posted above
Great idea.
TimberLand
09 May 2001, 05:21
That was just an idea I had. I would like to know as well. Any hackers interested.
easy dude
Just insert
$totalviews since 1-5-01 into where you want it on your forum home template
:)
Well, it's very simple. Where ever you stick the $totalviews, just put the text by that. For example, if you put it in your forumhome template, so it's below your total threads and total posts, as I did, like this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
You could just change it to this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
(Or use whatever date it was when you converted from UBB to vB.)
TimberLand
09 May 2001, 06:31
Where do you paste the code at, in the index.php? Anywhere special.
Can someone give an example of placement.
Thanks
Dan
in the forum home template
Put it under launch buddy list or wherever
Originally posted by JJR512
Well, it's very simple. Where ever you stick the $totalviews, just put the text by that. For example, if you put it in your forumhome template, so it's below your total threads and total posts, as I did, like this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
You could just change it to this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
(Or use whatever date it was when you converted from UBB to vB.)
TimberLand
09 May 2001, 07:01
Thanks very much,
What about the index.php file I need to edit. Where should I put the code it's says in the above post. It say cut and paste this code into the index.php file.
just find a place... like under total posts in index.php
TimberLand
09 May 2001, 13:46
I can't find total posts in the index.php file. Can someone cut out a small part of this file were they have this code placed in the index.php file?
// Total Thread Views
$boardviews = $DB_site->query_first("
SELECT SUM(views) AS threadviews FROM thread");
$totalviews = number_format($boardviews[threadviews]);
In index.php, look for this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Place the code for this hack above this line.
This is how mine looks:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
TimberLand
10 May 2001, 06:09
Worked like a charm. I was getting messed up because I didn't realize at first there are two index files.
Alwaysmefirst
27 May 2001, 10:50
Very cool hack :)
Thanks for posting it.
Olly
Thanks for the hack, very nice.
Is there any way to include this hack onto a Non-VB page?
I've added the correct code into my /forums/index.php..
and then I made a new file named totalthreadviews.inc.php with this code:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Then I opened up my non-vb page and tried to include that file.. but it didn't work at all..
Any ideas on this one?
Very nice and simple hack, appreciated :)
That's a great hack, thanks alot :D
Any change of putting this into the "stats" in the VB control panel to give more of a per day/week/month effect listing?
Streicher
11 Jun 2001, 21:22
If you want the views displayed without a "," then use this code instead:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
webhost
13 Jun 2001, 14:33
Thanks for the hack. Works Great
Joey;)
ThomasP
15 Jun 2001, 12:51
Originally posted by Streicher
[B]If you want the views displayed without a "," then use this code instead (...)
Thanks - that was what I was looking for! :D
Grüße nach Reinbek,
-Tom
i tried to post that code in the index.php file but it did not work .... can some body add this hack to that file and put it for downloading plz.:(
webhost
12 Jul 2001, 15:34
Hack works great.
How would someone also add under a members profile the total amount of page views that member has?
I think im the only one who cant get this hack to work :(
I did two things as instructed - add that piece of code in my /forums/index.php file exactly the same way JJR512 did it
and I added <b>$totalviews</b> total thread views - in the forum home template
When I refreshed - all i saw was total thread view with no number next to it :(
Whats wrong?
Thanks in advance - im using v2.0.1 btw
webhost
13 Jul 2001, 19:08
Here is how I have mind setup in the forumhome template.
Registered Members: <b>$numbermembers</b><br>
Total Threads: <b>$totalthreads</b> | Total Posts: <b>$totalposts</b> | Total Views: <b>$totalviews</b><br>
webhost
13 Jul 2001, 19:12
This is what my index.php looks like.
$totalthreads=$countthreads['threads'];
if ($totalthreads=='') {
$totalthreads=0;
}
// Total Thread Views
$boardviews = $DB_site->query_first("
SELECT SUM(views) AS threadviews FROM thread");
$totalviews = number_format($boardviews[threadviews]);
Webhost
I thought u were just suppose to add
// Total Thread Views
$boardviews = $DB_site->query_first("
SELECT SUM(views) AS threadviews FROM thread");
$totalviews = number_format($boardviews[threadviews]);
How come you got some extra code above this?
btw - pardon my lack on php knowledge - but are there permissions set for php files?
webhost
13 Jul 2001, 19:31
yes code above above ties in with something else.
Email me your index.php and forumhome template for me to look at to joeymoses1@home.com
Here you go Webhost or anyone else who is willing 2 help me out :) - I copied and pasted the forum home template source in a txt file
Thanks :)
This is how i edited the index.php file -
I went to my ftp proggy (Cute FTP) first I made a backup of the index file by downloading it on my harddisk - then I right clicked and edited the index file from my uploaded version - it opened into notepad - then added the code - and uploaded the amended version..
I take it php files do not have chmod permissions, do they?
webhost
13 Jul 2001, 21:42
Try inserting the bold item below
// Total Thread Views
$boardviews = $DB_site->query_first("
SELECT SUM(views) AS threadviews FROM thread");
$totalviews = number_format($boardviews[threadviews]);
}<--- I think you need that
// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
Love this simple hack. Got it installed on my boards. Good job!
webhost mate - tried that = still no joy :(
I guess this hack doesnt wanna work on my board! ( sob sob)
Anybody got any other ideas?
webhost
14 Jul 2001, 05:24
try uploading this index.php file, first backup your file on your hardrive then delete the index.php file on your server and upload this one.
[Zip Removed -- don't post full source code!]
webhost
14 Jul 2001, 05:26
lukman give a url to your board
ForzaGrifo
16 Jul 2001, 06:32
Lukman, try removing the spaces around the = signs. I had the same problem and now it's working perfect. That should do the trick.
Anyone knows why the lines won't get parsed if there's space around the equal sign?
Ive tried everything - no luckwhatsoever :(
I removed the spaces between the = sign - even uploaded webhosts index.php file but to no avail!
Ive gived up now - It would have been nice to see an extra stat on the main page but oh well - it dont matter!
Thanks Webhost for all yer help and same goes for ForzaGrifo
webhost
17 Jul 2001, 17:51
Lukman
With the new index.php file and template loaded with the script in it open your forum to the first page. Once there right click and view source. Save this file and email it to me Joeymoses1@home.com
TripleH
20 Jul 2001, 06:56
How can I put it so under the avatar it shows how many personal views tehre are??
and same with threads starteD? i have seen it done but not sure how..
thanks'
HHH
webhost
20 Jul 2001, 10:24
http://www.vbulletin.com/forum/showthread.php?threadid=17116
Good Hack !! Like it ! ;)
ThomasP
02 Aug 2001, 22:12
Works great!
TripleH
04 Aug 2001, 07:11
Ok. I got the personal views.. But now I don't know how to get the threads started to show up... I can get it to show up in the members profile, but i can't get it to show up in the postbit template where it shows how many personal views, posts, and other crap is..
anyone know how?
HHH
Cool hack ! I like it ! thanks ! Rocks !
webhost
10 Aug 2001, 00:16
are you using vb 2.0.3
dilirum
19 Aug 2001, 13:42
Works great for me... thanks.
Originally posted by LuBi
Does this work in 2.0.3?
You bet - here is a working example: http://sportscentralboards.com
eva2000
27 Aug 2001, 03:51
Originally posted by LuBi
Does this work in 2.0.3? yup i have total threadviews at the top of my forum and total pageviews at the bottom http://vbulletin.com/forum/showthread.php?s=&threadid=26527 :D
Is there any way to make it so it can display daily, Record, and Total?
Craig Armstrong
02 Dec 2001, 16:58
Works Great. Thanks!
Bimma Boy
17 Dec 2001, 12:42
Jus digged this up:D
Does this hack workon 2.2.1 guys? I think it does, as this site has thread views thingy.. I just wanna be sure that I have my hands on the right hack! ;)
Thanks all!
Originally posted by Bimma Boy
Jus digged this up:D
Does this hack workon 2.2.1 guys? I think it does, as this site has thread views thingy.. I just wanna be sure that I have my hands on the right hack! ;)
Thanks all! Yes, it works on 2.2.1. :)
Michael2
05 Jan 2002, 18:41
I know this has been mentioned but I just wanted to say that removing the space before and after the = sign got it to work for me. Before doing that I was getting parse errors. Just in case someone else has the same problem. Now it works great! Thanks!
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.