Shoutbox help for standalone

50 views
Skip to first unread message

taegam...@gmail.com

unread,
Jan 13, 2016, 7:32:32 PM1/13/16
to AJAX-chat
Okay, you guys are going to probably get tired of me posting my questions in the thread, but I'm a total n00b at the backend side of AJAX Chat. I've only used the client side. I need help on setting up the shoutbox of my AJAX chat room. I have two websites ,one for the "full screen" mode of the site, and one where I plan to put the shoutbox on. How can I set this up?

Fabian Wilson

unread,
Jan 14, 2016, 8:07:30 AM1/14/16
to taegam...@gmail.com, AJAX-chat
The readme.html file has the instructions.

Shoutbox

AJAX Chat is also usable as shoutbox - this is a short guide on how to set it up:

Shoutbox Stylesheet

Add the following line to the stylesheet (CSS) of all pages displaying the shoutbox:

@import url("http://example.org/path/to/chat/css/shoutbox.css");

Replace http://example.org/path/to/chat/ with the URL to the chat.
Modify css/shoutbox.css to your liking.

Shoutbox Function

Add the following function to your PHP code (To the top of the page you want the shoutbox displayed on. Also you can place in a separate file and call it like this  include('path/shoutbox.php');:

<?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;
}
?>

Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory.

Shoutbox Output

Display the shoutbox content using the shoutbox function (This is the code that will display the shoutbox. Place this code where you want the shoutbox):

<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Please let me know if you have any questions.


On Wed, Jan 13, 2016 at 6:32 PM, <taegam...@gmail.com> wrote:
Okay, you guys are going to probably get tired of me posting my questions in the thread, but I'm a total n00b at the backend side of AJAX Chat. I've only used the client side. I need help on setting up the shoutbox of my AJAX chat room. I have two websites ,one for the "full screen" mode of the site, and one where I plan to put the shoutbox on. How can I set this up?

--
You received this message because you are subscribed to the Google Groups "AJAX-chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ajax-chat+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages