Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2002, 11:32 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Getting total # of threads for certain forums on non vb page?

I have a few sections on my frontpage that I would like to show the users how many threads have been started in that forum. I need it to also be able to work multiple times on the same page though, meaning I want to show the total threads in different places and for different forums.

If you can help me with this I would really appreciate it.

Thanks!
Reply With Quote
  #2  
Old 07-14-2002, 10:08 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i would like this to incluede on my portal too...
Reply With Quote
  #3  
Old 07-16-2002, 04:19 AM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bump!
Reply With Quote
  #4  
Old 07-19-2002, 06:36 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #5  
Old 07-26-2002, 04:34 AM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #6  
Old 07-26-2002, 06:13 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can use the algorithm:

https://vborg.vbsupport.ru/showthrea...926#post276926

Change the query to anything you like and it will display any info you queried in a non-vb page.

Needless to say, you need to insert this code into a page with .php extension..
Reply With Quote
  #7  
Old 08-03-2002, 07:17 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Logician
You can use the algorithm:

https://vborg.vbsupport.ru/showthrea...926#post276926

Change the query to anything you like and it will display any info you queried in a non-vb page.

Needless to say, you need to insert this code into a page with .php extension..
I put

PHP Code:
<?

require("admin/config.php");
mysql_connect("$servername", "$dbusername", "$dbpassword") or die("Couldnt find MYSQL!");
mysql_select_db("$dbname")  or die ("Couldnt find DB!");
$totalviews=mysql_query("SELECT SUM(views) AS threadviews FROM thread");
if (mysql_error()) {echo "mySQL error:"; echo mysql_error(); exit;}
else
{echo mysql_result($totalviews,0);} 
?>
into my frontpage, but it only shows the totalviews. How do I change it so that it shows the total threads that have been made in a certain forum?
Reply With Quote
  #8  
Old 08-03-2002, 07:57 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

NM, I got it to work by tweaking a last 24 posts hack. Thanks anyway.
Reply With Quote
  #9  
Old 08-04-2002, 01:28 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can u share the code with me please gutspiller ?
Reply With Quote
  #10  
Old 08-04-2002, 11:50 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, here's the code:

PHP Code:
<?
$last24 = time() - 0;
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE lastpost < $last24 AND (forumid = '999')"));
echo number_format($threads[total]);
?>
Slap that on a non-vb page that has a php extension and it should work. Change 999 number to the forum id that you want.

There might be an easier way and I don't know if this takes longer to do than some other way, but since I couldn't get any help. I had to use a work around and it works.

You can also get the total for multiple forums by doing something like this:

PHP Code:
<?
$last24 = time() - 0;
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE lastpost < $last24 AND (forumid = '143' OR forumid = '162' OR forumid = '161' OR forumid = '163' OR forumid = '145' OR forumid = '153' OR forumid = '164' OR forumid = '155' OR forumid = '167' OR forumid = '158' OR forumid = '165' OR forumid = '166' OR forumid = '127')"));
echo number_format($threads[total]);
?>
Seems to work on my front page, and it's running 12 times on my front page for different forums. If you want to see it in action you can check out www.3dNewz.com
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:07 PM.


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.03988 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete