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: 06-25-2000 Last Update: Never Installs: 0
 
No support by the author.

Hello everyone-

This isn't as much a "vBulletin Hack" as it is, an "already existing hack hack". I based it on Krucifyx's active threads hack, but I cleaned it up with some code that I stole from Wanderer's Active Topic hack.

Basically, it is a stripped down version, which just displays the currently active topics, and the amount of replies. No icons, user names, or post info. I did this so that it would be easier to embed in an already existing page, like an index page, instead of having to use a totally separate page just for the active topics.

I only wanted it to take posts from one forum, and only display the last five active topics. The forum number can be changed, as can the amount of posts. Maybe someone could rework it to display multiple forums easily. Otherwise I guess you could implement multiple instances of the code.

Anyway, on to the good stuff:

Here is a working example:
http://www.bronx-bombers.com/index.php

And here is the code:

Code:
<? 
    include("forums/admin/config.php"); 
// The variables 
$fontface = "arial"; 
$forumfontsize = "2"; 
$fontsize = "1"; 
$tablewidth = "100%"; 

print "<table border=0 width=$tablewidth cellspacing=3 cellpadding=3>\n"; 

if (!$topics) { 
$topics = "5"; 
} 

/* 
############################################################################## 
# Lets Setup and Connect to the Database                                     # 
############################################################################## 
*/ 

    $db=mysql_connect($servername,$dbusername,$dbpassword); 
    mysql_select_db($dbname); 



// Lets find out how many forums there are 
  $forumquery = "select * from forum where forumid=5"; 
  $forumresult = mysql_query($forumquery); 
  $forumcount = mysql_numrows($forumresult); 


while($row = mysql_fetch_object($forumresult)) { 
if ($row->active == "1") { 



// Now lets find the latest threads 
  $threadquery = "select * from thread where forumid=5 order by lastpost desc limit 0,$topics"; 
  $threadresult = mysql_query($threadquery); 
  $threadcount=mysql_numrows($threadresult); 

if ($threadcount == "0") { 
    print "<tr><td colspan=3><font face=\"$fontface\" size=\"$fontsize\">No Posts yet. <a href=forumdisplay.php?forumid=5>"; 
    print "Click here</a> to be the first!</font></td></tr>\n"; 
} // End if declaration 

else { 

    while($row = mysql_fetch_object($threadresult)) { 

    if ($row->replycount == "0") { 
      $row->replycount = "No Replies"; 
    } 
    elseif ($row->replycount == "1") { 
      $row->replycount = "1 Reply"; 
    } 
    else { 
      $row->replycount = "$row->replycount Replies"; 
    } 

    print "    <tr>\n"; 
    print "      <td width=\"75%\" valign=\"top\">$TDColor<font face=\"$fontface\" size=\"$fontsize\"><a href=showthread.php?threadid=$row->threadid>$row->title</a></font></td>\n"; 
    print "      <td align=\"right\" width=\"25%\" valign=\"top\"><font face=\"$fontface\"size=\"$fontsize\">$row->replycount</font></td>\n"; 
    print "    </tr>\n"; 

    } 

} // End else declaration 
} // End if declaration 
} // End while loop 


mysql_close(); 
?>
There are two instances of the forum number that you want to use, in the example code it is #5. Other than that, it is pretty self explanitory. Just stick it somewhere in a php file, and there you go.

My thanks go to Krucifx and Wanderer for letting me use their code to make it do what I wanted it to do. I can't take any credit (or responsibility ) for the coding, since all I did was modify the code that they made.

Just thought I'd make my first *real* contribution to the community, despite how tiny it is.

-jim

[Edited by JimF on 06-25-2000 at 11:36 PM]

Show Your Support

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

Comments
  #2  
Old 06-29-2000, 02:49 PM
Guest
 
Posts: n/a
Default

hi jim, singloon here again

i am wanting to have the last active topic added to my forum's main front page

http://www.animeboards.net/

i am lost to what i have to do? also can it be adjusted to show the last 5, 10, 15, 20 threads ?
Reply With Quote
  #3  
Old 06-30-2000, 09:36 PM
Guest
 
Posts: n/a
Default

Don't forget a </table> tag at the bottom...
Reply With Quote
  #4  
Old 07-20-2000, 07:25 AM
Guest
 
Posts: n/a
Default

Lookie here, I thought this hack had gone unnoticed. If you're still interested, all you have to do is insert the code wherever you would like the topics to be on your page. If you look through it, you will see a few places to adjust the quantity of posts, and also which forum number to take them from. And also add the </table> tag as akiy pointed out. I'm sorry I'm not more of a help, but it's been so long since I did this...

If it helps, the forum number in the example is 5, as well as the amount of topics to display. Let me know if there is anything else you're unclear on. I suppose I should clean this up a little bit, now that I actually *know* php . Maybe if Sir Sullivan is bored, he could take a quick look at it. I'm sure there would be an easy and efficient way to change all the settings - this code was basically thrown together to accomplish something for my site, so I didn't really plan on documentation and everything, as well as ease of use .

Sorry about that - and sorry about the delay in replying - I hadn't seen it until I started looking for something else.

-jim
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 06:05 AM.


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.05542 seconds
  • Memory Usage 2,225KB
  • 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
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)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
  • 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