MyBB Community Forums

Full Version: how to show 10 latest threads outside the forum directory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to show 10 latest threads outside the forums directory in php pages ? from all the forums.
for example, make file: grab.php
this is for latest post discussion..
for latest thread, change t.lastpost --> t.tid

<?php
define("IN_MYBB", 1);
require_once "./global.php";

	$query = $db->query("
		SELECT t.*
		FROM ".TABLE_PREFIX."threads t
		ORDER BY t.lastpost DESC 
		LIMIT 0,10"
	);
	while($thread = $db->fetch_array($query))
	{
		$thread['subject'] = htmlspecialchars_uni($thread['subject']);
		$thread['threadlink'] = get_thread_link($thread['tid']);
		echo "<a href=\"http://www.yourforum.com/".$thread['threadlink']."\">".$thread['subject']."</a><br>";
	}

?>
Instead of using http://www.yourforum.com , it would be better to use $mybb->settings['bburl']
thanks Yaldaram Wink
awesome mod,thanks.
You can see this mod in action at http://www.flashvoicevideochat.com/index.php at the bottom.
can we do more modification like show by post ?
Just what I need for a future site, thank you very much!