Skip to content

Phpbb3 shoutbox integration

Frug edited this page Oct 18, 2012 · 1 revision

How to integrate the AJAX Chat shoutbox with your phpBB3 forum

Edit includes/functions.php
Add:

	// Get the URL to the chat directory:
	if (!defined('AJAX_CHAT_URL'))
	{
		define('AJAX_CHAT_URL', $phpbb_root_path . 'chat/');
	}

	// Get the real path to the chat directory:
	if (!defined('AJAX_CHAT_PATH'))
	{
		if (empty($_SERVER['SCRIPT_FILENAME']))
		{
			$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_URL'];
		}
		define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/chat') . '/');
	}

	// Validate the path to the chat:
	if (@is_file(AJAX_CHAT_PATH . 'lib/classes.' . $phpEx))
	{
		// Include Class libraries:
		require_once(AJAX_CHAT_PATH.'lib/classes.' . $phpEx);

		// Initialize the shoutbox:
		$ajaxChat = new CustomAJAXChatShoutBox();

		// Parse and return the shoutbox template content:
		return $ajaxChat->getShoutBoxContent();
	}

	return null;
}

before

?>

Add:

      'SHOUTBOX'                  => getShoutBoxContent(),
after
   // The following assigns all _common_ variables that may be used at any point in a template.
   $template->assign_vars(array(


Edit styles/[STYLE_NAME]/theme/stylesheet.css
Add:

@import url("../../../chat/css/shoutbox.css");
at the end of the file.


Edit styles/[STYLE_NAME]/template/overall_footer.html
Add

<div style="font-size: 1.2em; margin-bottom: 20px;">{SHOUTBOX}</div>

<div id="ajaxChatCopyright"><a href="https://blueimp.net/ajax/">AJAX Chat</a> &copy; <a href="https://blueimp.net">blueimp.net</a></div>

after

<div id="page-footer">