syco Posted March 25, 2008 Share Posted March 25, 2008 On several website, i have seen their, news automatically come from the forum to the homepage and then say how many comments, and things like that. i am interested in that so if you could help that would be appreciated!!!Example:http://thesonicworld.net/home.php Link to comment Share on other sites More sharing options...
Synook Posted March 26, 2008 Share Posted March 26, 2008 If you want to integrate with a existing forum system, then all you need to do is SELECT the last few posts from the forum's thread table and display them. For example, phpBB3 stores the threads in a table called phpbb_topics, which has some information. Say your news was all in forum 2 (check in phpbb_forums), then you could do it as such: //connect to phpbb database$result = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id = 2 ORDER BY topic_time DESC LIMIT 5");echo "<table>";echo "<th>Date</th><th>Topic</th><th>Posts</th>";while ($topic = mysql_fetch_assoc($result)) {echo "<tr>";echo "<td>" . date("d/m/y", $topic['topic_time']) . "</td>";echo "<td><a href=\"forum/viewtopic.php?f=2&t={$topic['topic_id']}\">{$topic['topic_title']}</a></td>";echo "<td>{$topic['topic_replies']}</td>";echo "</tr>";}echo "</table>"; That should work if you are using phpBB3 (though there are probably errors, I just wrote it then). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.