Hi guys,
Anyone knows what I must do to have the links automatically updated for the latest posts in the forums such as on the index page of Sitepoint ?
Printable View
Hi guys,
Anyone knows what I must do to have the links automatically updated for the latest posts in the forums such as on the index page of Sitepoint ?
Here's what we use:
Quote:
<?php
// Set this to the max number of threads to display
$maxthreads = 10;
require("config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword);
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 class=\"hotTopicsLink\" SIZE=\"-1\" FACE=\"Arial, Helvetica, sans-serif\">
<A HREF=\"http://www.sitepointforums.com/showthread.php?threadid=$latest_array[threadid]\"><IMG SRC=\"graphics/hottopic.gif\" WIDTH=\"15\" HEIGHT=\"9\" BORDER=\"0\">$latest_array[title]</A></FONT><BR>";
}
?>
So it's in real time? That's cool!
I thought it only updates once in a while.
Jason,
To include this on the other sites on your network did you make that a file and include it using PHPs include?
A change needs to be made, though, to explode links to threads in the private forums - I see links such as "Spammer Posts" and click on them, and am told I'm either ont logged in, or do not have permission to access that area.
Some of the thread titles have also been a little revealing - just a little, though.