vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [Release VB2] Total Thread Views (https://vborg.vbsupport.ru/showthread.php?t=14739)

SystemLogic 04-19-2001 10:00 PM

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.

PHP Code:

// Total Thread Views

$boardviews $DB_site->query_first("
    SELECT SUM(views) AS threadviews FROM thread"
);
$totalviews number_format($boardviews[threadviews]); 

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 04-21-2001 03:22 AM

good hack min :D

JJR512 04-21-2001 04:07 AM

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 04-21-2001 04:35 AM

nice :)

SystemLogic 04-21-2001 04:47 PM

Quote:

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 04-21-2001 09:26 PM

Good idea! Thx for repost it as a own thread.:)

n3n 04-27-2001 04:58 AM

great little hack!!
I have added this feature on my forum ^_^
thanks

TimberLand 05-07-2001 10:29 PM

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

Sarge 05-08-2001 08:49 PM

where do I insert this at?

what line number?

And what about adding "Thread views since""
Like posted above

Great idea.

TimberLand 05-09-2001 03:21 AM

That was just an idea I had. I would like to know as well. Any hackers interested.

Sarge 05-09-2001 03:26 AM

easy dude

Just insert

$totalviews since 1-5-01 into where you want it on your forum home template
:)

JJR512 05-09-2001 03:27 AM

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:

<b>$totalviews</b> total thread views
You could just change it to this:
Code:

<b>$totalviews</b> total thread views since May 7, 2001
(Or use whatever date it was when you converted from UBB to vB.)

TimberLand 05-09-2001 04:31 AM

Where do you paste the code at, in the index.php? Anywhere special.

Can someone give an example of placement.

Thanks
Dan

Sarge 05-09-2001 04:35 AM

in the forum home template

Put it under launch buddy list or wherever

JJR512 05-09-2001 04:42 AM

Quote:

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:

<b>$totalviews</b> total thread views
You could just change it to this:
Code:

<b>$totalviews</b> total thread views since May 7, 2001
(Or use whatever date it was when you converted from UBB to vB.)


TimberLand 05-09-2001 05:01 AM

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.

Sarge 05-09-2001 05:03 AM

just find a place... like under total posts in index.php

TimberLand 05-09-2001 11:46 AM

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]);

JJR512 05-09-2001 04:40 PM

In index.php, look for this:
Code:

// get newest member
Place the code for this hack above this line.

This is how mine looks:
PHP Code:

// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=$countposts['posts'];
if (
$totalposts=='') {
  
$totalposts=0;
}
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$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]);

// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid']; 


TimberLand 05-10-2001 04:09 AM

Worked like a charm. I was getting messed up because I didn't realize at first there are two index files.

Alwaysmefirst 05-27-2001 08:50 AM

Very cool hack :)
Thanks for posting it.

Olly

max 05-28-2001 04:34 PM

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:

<?php

$font = "Verdana";
$fontsize = "8pt";

require("/home/max/public_html/forums/index.php");
$boardviews = $DB_site->query_first("
SELECT SUM(views) AS threadviews FROM thread");
$totalviews = number_format($boardviews[threadviews]);
echo "<font-family: $font; font-size: $fontsize\"><b>$totalviews</b> total thread views</font>";
?>

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?

Martz 05-29-2001 12:54 PM

Very nice and simple hack, appreciated :)

Zorg 06-09-2001 12:27 PM

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 06-11-2001 07:22 PM

If you want the views displayed without a "," then use this code instead:

PHP Code:

$boardviews=$DB_site->query_first("SELECT SUM(views) AS threadviews FROM thread");
$totalviews=$boardviews['threadviews']; 


webhost 06-13-2001 12:33 PM

Thanks for the hack. Works Great

Joey;)

ThomasP 06-15-2001 10:51 AM

Quote:

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

king98 06-16-2001 09:29 AM

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 07-12-2001 01:34 PM

Hack works great.
How would someone also add under a members profile the total amount of page views that member has?

Lukman 07-13-2001 04:59 PM

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 07-13-2001 05:08 PM

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 07-13-2001 05:12 PM

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]);

Lukman 07-13-2001 05:27 PM

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 07-13-2001 05:31 PM

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

Lukman 07-13-2001 05:50 PM

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 07-13-2001 07:42 PM

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'];

mjames 07-14-2001 01:14 AM

Love this simple hack. Got it installed on my boards. Good job!

Lukman 07-14-2001 02:52 AM

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 07-14-2001 03:24 AM

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 07-14-2001 03:26 AM

lukman give a url to your board


All times are GMT. The time now is 03:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01387 seconds
  • Memory Usage 1,826KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete