<?php
// get latest x forum posts from xenforo by liamdawe
// edit this to whatever folder your forum is in
$forum_url = '/';
// change to the amount of posts you want displayed
$limit = 10;
$node = 9;
// edit this to the directory your forum is in
$forum_directory = '/home/mysite/public_html';
$startTime = microtime(true);
require($forum_directory. '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($forum_directory . '/library');
GeekPoint_Symfony::initializeXenforo($forum_directory, $startTime);
$nodeModel = XenForo_Model::create('XenForo_Model_Node');
$nodes = $nodeModel->getViewableNodeList();
$nodes_get = array_keys($nodes);
$node_id_list = implode($nodes_get, ',');
$sql_forum = "SELECT `title`, `thread_id`, `view_count`, `reply_count` FROM `xf_thread` WHERE `node_id` = $node ORDER BY `last_post_date` DESC LIMIT {$limit}";
$topics_query = XenForo_Application::get('db')->fetchAll($sql_forum);
foreach ($topics_query as $thread)
{
// The absolute thread url is constructed for you
$threadUrl = XenForo_Link::buildPublicLink('full:threads', $thread);
// Trimmed and properly escaped
$threadTitle = XenForo_Template_Helper_Core::helperWordTrim($thread['title'], 50);
echo "<a href=\"$threadUrl\">$threadTitle</a><br />
<br />";
}
?>