StealthBravo
Member
I'm currently leading the move to XenForo from Enjin, as our community has outgrown it, plus I hate Enjin with a passion. I have lots of experience with IPB and MyBB, but not too much with XF, so excuse my ignorance.
Using the following code to try to display the number of players on our server in the header of the forum:
This is calling a class from library/scripts/players named players.php
Using this code, I get the following error: Could not execute callback players_main::getHtml() - Not callable.
Using this project to grab players online, obviously, with some edits for our site: https://github.com/FunnyItsElmo/PHP-Minecraft-Server-Status-Query
The rest of the files are irrelevant, but what am I doing wrong here?
Using the following code to try to display the number of players on our server in the header of the forum:
HTML:
<xen:edithint template="header.css" />
<xen:hook name="header">
<div id="header">
<xen:include template="logo_block" />
<div id="notice">
<xen:callback class="players_main" method="getHtml"></xen:callback>
</div>
</div>
</xen:hook>
This is calling a class from library/scripts/players named players.php
PHP:
<?php
class players_main
{
public static function getHtml()
{
include_once 'MinecraftServerStatus/status.class.php'; //include the class
$status = new MinecraftServerStatus(); // call the class
$response = $status->getStatus('ulmc.net'); // call the function
if(!$response) {
echo"Server Offline. Try refreshing the page, or waiting a few minutes.";
} else {
echo $response['players']."/".$response['maxplayers']." currently online";
}
}
}
?>
Using this code, I get the following error: Could not execute callback players_main::getHtml() - Not callable.
Using this project to grab players online, obviously, with some edits for our site: https://github.com/FunnyItsElmo/PHP-Minecraft-Server-Status-Query
The rest of the files are irrelevant, but what am I doing wrong here?