Seite 1 von 1

Integration einer Ajax-Shoutbox

Verfasst: 22.01.2009 20:38
von Schafi
Hallo Leute,

ich habe eine Shoutbox / einen Chat von http://sourceforge.net/project/showfile ... _id=214758 herunter geladen und installiert. Soweit so gut. Sie scheint auch zu funktionieren. Ich würde sie nun gerne in das Forum integrieren. Nutze den Style subsilver2. Welches Template muss ich nutzen? Habe schon viel probiert, aber es funktioniert nicht (im Forum ändert sich gar nichts - auch nicht, wenn ich aktualisiere).

Es wäre super, wenn mir jemand helfen könnte, wo ich den Code / die Codes einfügen muss, damit es funktioniert.

Vielen Dank!

Das hier ist in der Readme zu lesen:

Shoutbox:
=========

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


1. 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.


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>

Re: Integration einer Ajax-Shoutbox

Verfasst: 23.01.2009 22:08
von worstbull
overall_header

Re: Integration einer Ajax-Shoutbox

Verfasst: 24.01.2009 00:53
von Metzle
Hallo,

je nachdem wo du deine Shoutbox platzieren willst, musst du die Datei styles/subsilver2/template/index_body.html bearbeiten und den Code für die Shoutbox, also der Code unter 2., einfügen. Eventuell könnten auch die Dateien styles/subsilver2/template/overall_header.html oder styles/subsilver2/template/overeall_footer.html dafür in Frage kommen.

Re: Integration einer Ajax-Shoutbox

Verfasst: 24.01.2009 11:34
von Schafi
Hi,

also ich habe jetzt folgenden Code in index_body.html eingefügt:

Code: Alles auswählen

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



<div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>
Es funktioniert nicht, d.h. es wird nichts angezeigt. Den Chat habe ich über einen Inline-Frame eingepflegt, das klappt sehr gut, ich möchte den Chat jetzt nur umwandeln in eine Shoutbox.

Vielleicht kann mir jemand sagen, ob ich an dem Quelltext noch etwas ändern muss.