The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Details »» | |||||||||||||||||||||||||
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(); ?> 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
|
Comments |
#2
|
|||
|
|||
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 ? |
#3
|
|||
|
|||
Don't forget a </table> tag at the bottom...
|
#4
|
|||
|
|||
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 |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|