Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 01-12-2001 Last Update: Never Installs: 0
 
No support by the author.

Anyone done this yet ?

a simple page listing most viewed thread in the past X days , sorted by forum which the thread hyperlinked showing the number of replies and views

- mostviewedthread [views: xx] [replies: xx]

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-12-2001, 12:26 PM
Guest
 
Posts: n/a
Default

Shows within the last 30 days.
Code:
<?
require("global.php");

$foruminfo=$DB_site->query("SELECT forumid, title FROM forum ORDER BY categoryid,displayorder");
while ($forum=$DB_site->fetch_array($foruminfo)) {
  echo ("<a href=\"forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a><br>");
  $threadinfo=$DB_site->query_first("SELECT threadid,title,replycount,views FROM thread WHERE forumid=$forum[forumid] and dateline > UNIX_TIMESTAMP(curdate()-30) ORDER BY views DESC LIMIT 1");
  echo ("&nbsp;&nbsp;<a href=\"showthread.php?threadid=".$threadinfo[threadid]."\">".htmlspecialchars($threadinfo[title])."</a>&nbsp;[views: ".$threadinfo[views]."]&nbsp;[replies: ".$threadinfo[replycount]."]<br>");
}

?>

Demo: http://sitepointforums.com/mostviewed.php

If you want to exclude certain forums. i.e. moderator forums, then add a WHERE clause to $foruminfo... For example:
WHERE forumid<>1
Reply With Quote
  #3  
Old 01-12-2001, 12:33 PM
Guest
 
Posts: n/a
Default

thanks.. is can be modified to slow the top X or 5 viewed threads per forum ?

forum 1
1. - mostviewedthread - [views: xx] [replies: xx]
2. - 2ndmostviewedthread - [views: xx] [replies: xx]
3. - 3rdmostviewedthread - [views: xx] [replies: xx]
4. - 4thmostviewedthread - [views: xx] [replies: xx]
5. - 5thmostviewedthread - [views: xx] [replies: xx]

forum 2
1. - mostviewedthread - [views: xx] [replies: xx]
2. - 2ndmostviewedthread - [views: xx] [replies: xx]
3. - 3rdmostviewedthread - [views: xx] [replies: xx]
4. - 4thmostviewedthread - [views: xx] [replies: xx]
5. - 5thmostviewedthread - [views: xx] [replies: xx]

all most forgot where forum is listed in order of diplay on forumhome page

thanks

[Edited by eva2000 on 01-12-2001 at 09:41 AM]
Reply With Quote
  #4  
Old 01-12-2001, 02:45 PM
Guest
 
Posts: n/a
Default

The forums should already be listed in the order they are displayed in forumhome. It orders them by categoryid and then by displayorder to get the same sequence.

Here is the code where you can change the number of threads shown. Just change the LIMIT on the second Query to modify the amount.

Code:
<?
require("global.php");

$foruminfo=$DB_site->query("SELECT forumid, title FROM forum ORDER BY categoryid,displayorder");
while ($forum=$DB_site->fetch_array($foruminfo)) {
  echo ("<a href=\"forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a><br>");
  $threadinfo=$DB_site->query("SELECT threadid,title,replycount,views FROM thread WHERE forumid=$forum[forumid] AND dateline > UNIX_TIMESTAMP(curdate()-30) ORDER BY views DESC LIMIT 5");
  while ($thread=$DB_site->fetch_array($threadinfo)) {
    echo ("&nbsp;&nbsp;<a href=\"showthread.php?threadid=".$thread[threadid]."\">".htmlspecialchars($thread[title])."</a>&nbsp;[views: ".$thread[views]."]&nbsp;[replies: ".$thread[replycount]."]<br>");
  }
}

?>
Reply With Quote
  #5  
Old 01-12-2001, 05:56 PM
Guest
 
Posts: n/a
Default

thanks.. it works perfectly

http://animeboards.net/forums/mostviewed.php
although for some reason the last recent forums i added, are old of the sort and display order i have on my forums ?
Reply With Quote
  #6  
Old 01-12-2001, 06:14 PM
Guest
 
Posts: n/a
Default

There seems to be a problem with your global.php file...

Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 756

Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 763
Reply With Quote
  #7  
Old 01-13-2001, 03:56 AM
Guest
 
Posts: n/a
Default

btw, this is OT, but i figure its not a *bad* spot to suggest it. my board has a few threads that have over 2^16-1 views, and the counter stops there.

might wanna fix that for v2.0
Reply With Quote
  #8  
Old 01-13-2001, 04:59 AM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by wluke
There seems to be a problem with your global.php file...

Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 756

Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 763

thanks.. i had some server problems and was playing around with the formatting.. it should work now
Reply With Quote
  #9  
Old 01-13-2001, 12:49 PM
Guest
 
Posts: n/a
Default

Nice addon but any way i can stop it displying private section posts?
thanks
cya trin
Reply With Quote
  #10  
Old 01-13-2001, 04:18 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by wluke
If you want to exclude certain forums. i.e. moderator forums, then add a WHERE clause to $foruminfo... For example:
WHERE forumid<>1

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 09:48 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.04396 seconds
  • Memory Usage 2,270KB
  • Queries Executed 23 (?)
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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)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
  • (9)postbit
  • (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_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
  • 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