Hi, I am trying to show this php output on my member_view template
I tried to insert the php callback inside my member_view template as so:
but it just showed a blank page written:
Any help please ? thx
PHP:
<?php
class GeekPoint_Last{
public static function getHtml(){
// get latest x forum posts from xenforo by liamdawe
// edit this to whatever folder your forum is in
$forum_url = 'C:/xampp/';
// change to the amount of posts you want displayed
$limit = 7;
// edit this to the directory your forum is in
$forum_directory = 'C:/xampp/htdocs/community/';
$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` IN ($node_id_list) 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> Views: {$thread['view_count']}, Comments: {$thread['reply_count']}<br />
<br />";
}
}
}
?>
I tried to insert the php callback inside my member_view template as so:
Code:
<xen:callback class="GeekPoint_Last" method="getHtml"></xen:callback>
but it just showed a blank page written:
Fatal error: Cannot redeclare class XenForo_Autoloader in C:\xampp\htdocs\community\library\XenForo\Autoloader.php on line 17
Any help please ? thx