janslu
Active member
I have just migrated to xenforo from vbulletin and now I need some assistance with integrating it with my other pages. I've searched for solutions but all my tests don't work and most information is in regard to plugins rather than external "bridges".
1. I need to make a super simple counter of users and guests on the forum to display on external pages (and use it for munin graphing). I've found a piece of code that is given as a solution, but I miss an elementary piece of information on how to use it:
If I put it inside my own class like this:
of course it doesn't have a clue on what "$this" is. And I have no idea how to make it to work.
2. I need to have a function for my own viewhelpers in a CMS to convert forumIds to URLs. I was trying to use the following code:
But I've got an error about logging problems
How do I solve such problem? What's at fault here? Is this a problem with configuration, or do I need to do something else, like use namespaces to separate classes?
Thank you
1. I need to make a super simple counter of users and guests on the forum to display on external pages (and use it for munin graphing). I've found a piece of code that is given as a solution, but I miss an elementary piece of information on how to use it:
Code:
protected function _getSessionActivityList()
{
$visitor = XenForo_Visitor::getInstance();
$sessionModel = $this->getModelFromCache('XenForo_Model_Session');
return $sessionModel->getSessionActivityQuickList(
$visitor->toArray(),
array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),
($visitor['user_id'] ? $visitor->toArray() : null)
);
}
If I put it inside my own class like this:
Code:
class bridgeXen
{
public function __construct() {
$startTime = microtime(true);
$fileDir = XF_ROOT;
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Session::startPublicSession();
}
function onlineUsers()
{
$visitor = XenForo_Visitor::getInstance();
$sessionModel = $this->getModelFromCache('XenForo_Model_Session');
return $sessionModel->getSessionActivityQuickList(
$visitor->toArray(),
array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),
($visitor['user_id'] ? $visitor->toArray() : null)
);
}
}
2. I need to have a function for my own viewhelpers in a CMS to convert forumIds to URLs. I was trying to use the following code:
Code:
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
// Not required if you are not using any of the preloaded data
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
XenForo_Link::useFriendlyUrls(true);
XenForo_Link::romanizeTitles(true);
switch ($numerUid) {
# ciąża
case 1267:
ourtput = '<li><a href="'.$this->urlXenforoForum(1).'" title="Forum id = 1">Fora id = 1</a></li>';
Code:
PHP Fatal error: Uncaught exception 'ErrorException' with message 'Undefined index: /var/www/hosts/www.babyboom.pl/typo3temp/logs/typo3.log' in /var/www/typo3_src-6.2.16/typo3/sysext/core/Classes/Log/Writer/FileWriter.php:170
Stack trace:
#0 /var/www/typo3_src-6.2.16/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(170): XenForo_Application::handlePhpError(8, 'Undefined index...', '/var/www/typo3_...', 170, Array)
#1 /var/www/typo3_src-6.2.16/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(74): TYPO3\CMS\Core\Log\Writer\FileWriter->closeLogFile()
#2 [internal function]: TYPO3\CMS\Core\Log\Writer\FileWriter->__destruct()
#3 {main}
thrown in /var/www/typo3_src-6.2.16/typo3/sysext/core/Classes/Log/Writer/FileWriter.php on line 170
Thank you