PDA

View Full Version : Request: Hottest Discussion Topics


08-09-2000, 08:06 AM
I'm looking for a hack that would allow us to post a list of the five most recent threads that have been updated on the front page of our site. We're currently using a PERL script on SitePoint.com that does that for UBB, but we're upgrading to vBulletin in the next week and we want to continue the "Hottest Discussion Topics" box on the front pages of our sites.

08-09-2000, 08:54 AM
hi ya matt, as a forum member at sitepoint akka prequel i love that you're moving to vbulletin :D

here's a few threads concerning similar hacks...

http://www.vbulletin.com/forum/showthread.php?threadid=1476
http://www.vbulletin.com/forum/showthread.php?threadid=249
http://www.vbulletin.com/forum/showthread.php?threadid=2153
http://www.vbulletin.com/forum/showthread.php?threadid=655

08-09-2000, 09:43 AM
well matt i found what i think you want
http://www.vbulletin.com/forum/showthread.php?threadid=655

i had problems using it as you will read

08-09-2000, 10:33 AM
OK here is what I have for you.....This will display the last 5 threads that were posted to on your homepage.

Check out the result here:

http://www.extremeforums.com/include/active.inc.php

Place the code below into a file called "active.inc.php"


<?php
// Set this to the max number of threads to display
$maxthreads = 5;

require("config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM thread ORDER BY lastpost DESC LIMIT $maxthreads";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"2\" FACE=\"Verdana, Arial, Helvetica, sans-serif\">&nbsp;°
<A HREF=\"http://www.extremeforums.com/forums/showthread.php?threadid=$latest_array[threadid]\">$latest_array[title]</A></FONT><BR>";
}

?>


On your homepage (where you want the list to appear add this code:

include("/full/path/to/active.inc.php");




Also you can edit the "echo" statement however you like....i just have them appear in a bulleted list with the font face that matches my site

Hope this helps,
~Chris


[Edited by TechTalk on 08-09-2000 at 07:34 AM]

08-09-2000, 02:06 PM
we have a number of hacks that to a variety of variations on this theme on our home page.

09-04-2000, 04:04 AM
Do you have anymore similar hacks, TechTalk? Like a display of the top posters, etc? Other such things I can use on normal PHP pags? :)

09-04-2000, 04:08 AM
Originally posted by TWTCommish
Do you have anymore similar hacks, TechTalk? Like a display of the top posters, etc? Other such things I can use on normal PHP pags? :)


Yea ive released some others in this forum. Heres some links to get you started:
http://www.vbulletin.com/forum/showthread.php?threadid=2284
http://www.vbulletin.com/forum/showthread.php?threadid=2285
http://www.vbulletin.com/forum/showthread.php?threadid=2286
http://www.vbulletin.com/forum/showthread.php?threadid=2283

HTH

~Chris

09-04-2000, 04:12 AM
Thanks man!

Got a problem with your original hack though...

I created the active.inc.php file and uploaded it to the forums/admin directory...I then stuck this line in my test.php file:

include("forums/admin/active.inc.php");

I got this error:

Fatal error: Failed opening required 'config.php' (include_path='') in forums/admin/active.inc.php on line 5

Any idea whats wrong?

09-04-2000, 04:18 AM
Originally posted by TWTCommish
Thanks man!

Got a problem with your original hack though...

I created the active.inc.php file and uploaded it to the forums/admin directory...I then stuck this line in my test.php file:

include("forums/admin/active.inc.php");

I got this error:

Fatal error: Failed opening required 'config.php' (include_path='') in forums/admin/active.inc.php on line 5

Any idea whats wrong?


Yep. Right before :

require("config.php");


Add:

chdir("forums/admin");


That should do it ;)

~Chris

09-04-2000, 01:30 PM
Still no luck. :(

Here's my active.inc.php file:



<?php
// Set this to the max number of threads to display
$maxthreads = 5;

chdir("forums/admin");
require("config.php");

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM thread ORDER BY lastpost DESC LIMIT $maxthreads";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"2\" FACE=\"Verdana, Arial, Helvetica, sans-serif\">&nbsp;°
<A HREF=\"http://www.extremeforums.com/forums/showthread.php?threadid=$latest_array[threadid]\">$latest_array[title]</A></FONT><BR>";
}

?>


It has been uploaded into the forums/admin directory.

I use this line to call the file: include("forums/admin/active.inc.php");

I get this error: Fatal error: Failed opening required 'config.php' (include_path='') in forums/admin/active.inc.php on line 6

Line 6 is the one requesting config.php - I'm perplexed! :)

09-04-2000, 01:33 PM
Nevermind! Got it to work! Thanks!

09-04-2000, 06:49 PM
Thanks alot!

I was just planning to start figuring this out myself when I read this

great work

N.

slideboxer
12-24-2001, 06:49 PM
I've gotten this hack to work but I'd like it to do a bit more than simply list the Thread title. Could someone please share the code to display the forum, thread title, poster, last posted and possibly include text from the latest post? Much like the "last XX posts" hack.

Thank you much