Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
Details »»

Version: , by duke duke is offline
Developer Last Online: Sep 2002 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 02-11-2002 Last Update: Never Installs: 0
 
No support by the author.

Im trying to disply the top viewed threads and did now find a hack to do this. So I tried this but it dont work any ideas on how I can complete this.

// Top 10 Viewed Threads//

$top = "10"; // change this to the number of top thread views you want to disply.

echo("<table border=0 cellpadding=0 cellspacing=0><tr><td><b>Top Viewed Threads </b></td></tr>");

$topthread = mysql_query("SELECT COUNT(*) AS count,title,views FROM thread ORDER BY count DESC LIMIT $top;");
$lugar=1;
while ($topview = mysql_fetch_array($topthread)):
if (($counter++ % 2) != 0);

echo("<tr><td><strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"$bburl/showthread.php?&$topthread[title]\">$topthread[threadid]</a></td><td align=\"center\">$topthreads[views]</td></tr>");
$lugar++;
endwhile;

echo("</table>");
echo("<br>");

Show Your Support

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

Comments
  #2  
Old 02-12-2002, 01:08 AM
duke duke is offline
 
Join Date: Dec 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got it to work with this code I just need some help with excluding some forums form it any ideas how to do this

// Top 10 Viewed Threads//

$top = "10"; // change this to the number of posters you want to show.

echo("<table border=0 cellpadding=4 cellspacing=0><tr><td><b>Top 10 Viewed Threads</b></td><td><br>");
echo("</table>");
echo("<table border=0 cellpadding=0 cellspacing=0><tr><td><b>Thread</b></td><td><b>Viewed</b></td></tr>");

$postsresult = mysql_query("SELECT COUNT(*) AS count,threadid,title,views,forumid FROM thread GROUP BY threadid ORDER BY views DESC LIMIT $top;");
$lugar=1;
while ($vthreads = mysql_fetch_array($postsresult)):
if (($counter++ % 2) != 0);

echo("<tr><td><strong><big>·</big></strong> $lugar: <a href=\"$bburl/showthread.php?s&threadid=$vthreads[threadid]\">$vthreads[title]</a></td><td align=\"center\">$vthreads[views]</td></tr>");
$lugar++;
endwhile;

echo("</table>");
echo("<br>");
Reply With Quote
  #3  
Old 02-12-2002, 09:49 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add:
Code:
WHERE forumid NOT IN (1,2,3,4,5,...)
to exclude forums.
Reply With Quote
  #4  
Old 02-12-2002, 01:15 PM
duke duke is offline
 
Join Date: Dec 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help, When tried

WHERE forumid NOT IN (1,2,3,4,5,...)

I got mysql errors

so I tried this and it works

WHERE forumid<>'1,2,3,4,5'
Reply With Quote
  #5  
Old 02-12-2002, 01:24 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But it's not correct, because you checking that the forumid is not equal to the STRING '1,2,3,4,5'. Use my code without the ... (I thought that was obvious).
Reply With Quote
  #6  
Old 02-12-2002, 02:05 PM
duke duke is offline
 
Join Date: Dec 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok thanks, I had it right the first time I tried your code, I had a nother error in the code that was causing my error I just found

Thanks for the Help
Reply With Quote
Reply

Thread Tools

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 02:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.14070 seconds
  • Memory Usage 2,240KB
  • Queries Executed 19 (?)
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)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete