phpBB

Development Discussion Board

phpBB's testing ground of bleeding edge code
Advanced search

ajax chat 0.8.3 shoutbox integration for a noob

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.

ajax chat 0.8.3 shoutbox integration for a noob

Postby Maliss » Wed Apr 07, 2010 12:14 am

Ok so I am very new to the world of phpbb coding. Somethings make sense to me and other things just go right over my head. I have been trying to integrate Ajax chat into a shoutbox on my forums for a few days now. I have the link to it http://sourceforge.net/apps/mediawiki/a ... ntegration

My biggest problem is I don't know what half of the things mean. I know where to place the code but I don't know what lines to edit and how it should look. Anyways I will pick apart the things I seem to be messing up and I hope all of you can be patient with me and tell me what it should look like.

Edit includes/functions.php
Add:

Code: Select all
function getShoutBoxContent()
{
   global $phpEx, $phpbb_root_path;

   // 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 :
Code: Select all
?>


This is my biggest problem. In here I have a hard time figuring out what AJAX_CHAT_URL and AJAX_CHAT_PATH should become. For the URL I figure its where my chat is located which is http:twinsuncoalition.com/forum/chat I could be way off, Thats why I am here. I am totally clueless on AJAX_CHAT_PATH. I am sure you could tell me what I am doing wrong but I would really appreciate a example of this using the code posted above.

Add:
Code: Select all
'SHOUTBOX'                  => getShoutBoxContent(),

after
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
   $template->assign_vars(array(


I can't seem to find the above piece of code when I search for it. Only a partial piece. I assume thats what I am looking for anyways. I hope someone can clear this up.

That seems to be my major problem and where ever I look for answers I come across people who are already well established in coding, I just can't seem to understand what stuff means. Atleast the parts I need to edit, I just guess what its supposed to be and sometimes I am right and sometimes I am wrong. I would really appreciate the help on some of these things.
Maliss
Registered User
 
Posts: 1
Joined: Wed Apr 07, 2010 12:01 am

Re: ajax chat 0.8.3 shoutbox integration for a noob

Postby Geed » Tue Sep 21, 2010 11:30 pm

Coincidently, I use this "mod" myself.

Maliss wrote:This is my biggest problem. In here I have a hard time figuring out what AJAX_CHAT_URL and AJAX_CHAT_PATH should become. For the URL I figure its where my chat is located which is http:twinsuncoalition.com/forum/chat I could be way off, Thats why I am here. I am totally clueless on AJAX_CHAT_PATH. I am sure you could tell me what I am doing wrong but I would really appreciate a example of this using the code posted above.


You shouldn't have to do any changing of AJAX_CHAT_URL and the such, that kind of stuff is done for you. All you need to do is find ?>, and copy paste that code before it.

Furthermore, if the partial piece is very close, it should work. (Don't quote me on that.)
Geed
Registered User
 
Posts: 1
Joined: Tue Sep 21, 2010 11:23 pm
Location: Eastern Washington


Return to [3.0/Olympus] Styling

Who is online

Users browsing this forum: No registered users and 3 guests