Ajax Chat na stronie głównej forum ?
: 02 września 2009, 18:02
Zainstalowałem i zintegrowałem z forum PHPBB3 specjalną wersję chatu "Ajax Chat". Mój problem polega na tym że nie wiem gdzie wstawić kod, aby chat znajdował się na głównej stronie forum. Moja znajomość php jest minimalna, więc proszę o wyrozumiałość.
Aby chat pojawił się na stronie trzeba gdzieś wpisać te kody, ale ja nie wiem gdzie:
Aby chat pojawił się na stronie trzeba gdzieś wpisać te kody, ale ja nie wiem gdzie:
Kod: Zaznacz cały
2. Shoutbox function
--------------------
Add the following function to your PHP code:
<?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.
2. Shoutbox output
------------------
Display the shoutbox content using the shoutbox function:
<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>