1 (edited by ShNaYkHs 2009-07-09 22:45)

Topic: Using ajax chat as shoutbox on punbb

Hello,
I found this Ajax Chat : https://blueimp.net/ajax/ whitch is compatible with punbb ( see ajax_chat-0.8.3_PunBB.zip here: http://sourceforge.net/projects/ajax-chat/files/ ).
I would like to use this Ajax Chat as shoutbox on the index of my punbb forum.
I found how to do this with phpbb3 but not with punbb.
http://ajax-chat.wiki.sourceforge.net/p … ntegration
How can I do it with punbb, please ? I think it isn't verry different.
Thanks.

Re: Using ajax chat as shoutbox on punbb

Is this what you needed?

Re: Using ajax chat as shoutbox on punbb

Slavok wrote:

Is this what you needed?

No, the Ajax Chat that I'm speaking about is this one: https://blueimp.net/ajax/ ( you can see demo here: http://chat.ecobytes.net/ )
It was integrated with punbb for users authentication so I installed it, but I want to use it as shoutbox on the index of my punbb forum. Can you help me to do this ?

Re: Using ajax chat as shoutbox on punbb

Assuming you already have it installed and working, follow these steps:

1.- After line 80 of 'header.php' add:

<link rel="stylesheet" type="text/css" href="chat/css/shoutbox.css" />

2.-  After line 39 of 'index.php' add:

$allow_guests = false;
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;
}
if(!$pun_user['is_guest'] && !$allow_guests)
{
?>
<div class="blocktable">
<h2>Shoutbox</h2>
<div class="box"><div class="inbox">
<?php echo getShoutBoxContent(); ?>
</div></div>
</div>
<?
}

Now, that may look a bit weird. To make it blend with PunBB do this:

1.- Replace the contents of 'chat/css/shoutbox.css' with: http://pastehtml.com/view/090710FrvUlEpn.txt

2.- Replace the contents of 'chat/lib/template/shoutbox.html' with: http://pastehtml.com/view/090710oXl9RDlD.txt

By the way, I disabled guest access to the shoutbox. To enable it, change '$allow_guests = false;' to ''$allow_guests = true;' on the chunk of code above.

Hope that helps smile

5 (edited by ShNaYkHs 2009-07-11 02:11)

Re: Using ajax chat as shoutbox on punbb

Cool it works big_smile Thank you a lot Garciat.