This is for phpBB 2 that I custom made
PHP Code:
$headlines_num = 8; $prefix = 'phpbb_'; // Have a forum you don't want latest posts displaying? If you have more just edit the $sql to include more of the forum_id != or if you don't want this just remove it $forum_bypass = 0;
//show headlines $sql = 'SELECT topic_title, topic_id, topic_time, topic_last_post_id FROM '.$prefix.'topics WHERE forum_id != $forum_bypass ORDER BY topic_last_post_id DESC LIMIT 0,'.$headlines_num.''; $out = mysql_query($sql) or die(mysql_error()); $count = 1; while($row = mysql_fetch_assoc($out)){
$sql2 = 'SELECT topic_id, post_time, poster_id FROM '.$prefix.'posts WHERE post_id = '.$row['topic_last_post_id'].' ORDER BY post_id DESC LIMIT 1'; $out2 = mysql_fetch_array(mysql_query($sql2)) or die(mysql_error());
$sql3 = 'SELECT username FROM '.$prefix.'users WHERE user_id = '.$out2['poster_id'].' limit 1'; $out3 = mysql_fetch_array(mysql_query($sql3)) or die(mysql_error());
echo '<p><strong><a href="forums/viewtopic.php?p='.$row['topic_last_post_id'].'#'.$row['topic_last_post_id'].'">'.$row['topic_title'].'</a></strong><br />By <a href="forums/profile.php?u='.$out2['poster_id'].'"><strong>'.$out3['username'].'</strong></a><br /><span class="smltime">' . elapsed_time($out2['post_time']) . '</span></p>'; }
Yes the layout of the code is tatty and the sql is not joined but oh well. Also you may have to edit the path to your current one instead of /forums
|