2012-08-04, 05:08 AM
I'm not sure if I'm doing this right.
To use open source Ajax chat as a chat box on MyBB the developer said to put this in a PHP file:
and this in a MyBB template:
The developer also said to, "Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory."
So I'm having trouble implementing this..
Do I just put the php in a chat.php file in the forums root and then paste the template code in index template? Will it work like that?
And I'm not sure what to edit in the PHP to make sure "AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory."
Please help!
To use open source Ajax chat as a chat box on MyBB the developer said to put this in a PHP file:
<?php
function getShoutBoxContent() {
// URL to the chat directory:
if(!defined('AJAX_CHAT_URL')) {
define('AJAX_CHAT_URL', './chat/');
}
// Path to the chat directory:
if(!defined('AJAX_CHAT_PATH')) {
define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
}
// Validate the path to the chat:
if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
// Include Class libraries:
require_once(AJAX_CHAT_PATH.'lib/classes.php');
// Initialize the shoutbox:
$ajaxChat = new CustomAJAXChatShoutBox();
// Parse and return the shoutbox template content:
return $ajaxChat->getShoutBoxContent();
}
return null;
}
?>
and this in a MyBB template:
<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>
The developer also said to, "Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory."
So I'm having trouble implementing this..
Do I just put the php in a chat.php file in the forums root and then paste the template code in index template? Will it work like that?
And I'm not sure what to edit in the PHP to make sure "AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory."
Please help!