Skip to first unread message

scyth...@outlook.com

unread,
Feb 12, 2016, 2:38:22 PM2/12/16
to AJAX-chat
I am having trouble understanding some of the Shoutbox installation instructions. 


I understand the first part, but just to be sure, is it supposed to be like this? :

The second step is what I don't get: 

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

Where do I put this? When they say "to your PHP code", do they mean on my index.php or what?

And for the third part: 

Shoutbox Output

Display the shoutbox content using the shoutbox function:

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


This just gets put wherever I want the shoutbox to be displayed right?

Fabian Wilson

unread,
Feb 12, 2016, 3:24:25 PM2/12/16
to scyth...@outlook.com, AJAX-chat
So your css is wrong should be something like this:
@import url("../../chat/css/shoutbox.css");
For the shoutbox function you can do this one of 2 ways first put the code inside of the page you want to display the shoutbox on or they way I recommend put the code in a separate file then call it from the shoutbox page:
include('inc/shoutbox.php');
 if you want to display the shoutbox on all of the web pages just add the include('inc/shoutbox.php'); to your footer and then add the shoutbox div to the footer as well.



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

scyth...@outlook.com

unread,
Feb 12, 2016, 9:54:23 PM2/12/16
to AJAX-chat, scyth...@outlook.com
Does go on my main stylesheet for my website or on the actual page where I want it to be loaded?

Fabian Wilson

unread,
Feb 12, 2016, 10:53:44 PM2/12/16
to scyth...@outlook.com, AJAX-chat

It goes in your main stylesheet.

Reply all
Reply to author
Forward
0 new messages