Author Topic: Quick&dirty - webIM and mambo  (Read 18815 times)

0 Members and 1 Guest are viewing this topic.

freepokero

  • Full Member
  • ***
  • Posts: 9
Quick&dirty - webIM and mambo
« on: April 13, 2009, 01:47:11 PM »
hi,

NOTICE: If you use Joomla 1.5 and above, see here -> http://mibew.org/forums/index.php?topic=161.0

So i included openwebIM fast and dirty in mambo, and for those of you who want to do that too, here is how i did it.

However: This is not a mambo/joomla component or anything, i just include the button and give the username of the logged in mambo user to the chat.

First, i made a "chatinclude.php" in the webim/ directory including this code:


ATTENTION: Look at the red highlighted pice of code in here ("+'&name='+escape(username)") this must be added to the button code you got from webIM! however, in this php file MY button code which i got from webIM is included, feel free to delete it (from "<!-- Botton Code" until the end). but make sure you add the red marked text afterwards!
Also note that i changed the width and height of the button in this example!

Code: [Select]
<?PHP

$username = $my->username;
switch($username) {
case '':
$username = 'Guest';
break;
case ' ';
$username = 'Guest';
break;
}
?>
<script>
var username = "<?php echo $username?>"
</script>
<!-- Button code. Attention!!! If you are editing the code, make sure to include "+'&name='+escape(username)" after "(document.referrer)"-->

<!-- webim button --><br><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 &amp;&amp; window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('/webim/client.php?locale=en&&amp;url='+escape(document.location.href)+'&amp;referrer='+escape(document.referrer)+'&name='+escape(username), 'webim', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/webim/button.php?image=webim&amp;lang=en" border="0" width="102" height="34" alt=""/></a><!-- / webim button -->

This is the last part of the code (the Button code) so i can highlight the thing you need to add ;-)

<!-- webim button --><br><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 &amp;&amp; window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('/webim/client.php?locale=en&&amp;url='+escape(document.location.href)+'&amp;referrer='+escape(document.referrer)+'&name='+escape(username), 'webim', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/webim/button.php?image=webim&amp;lang=en" border="0" width="102" height="34" alt=""/></a><!-- / webim button -->



Safe this file as chatinclude.php and upload it to your /webim/ directory.

Then go to the mambo template you use. open the index.php file and insert following at the position you want the button to appear:
Code: [Select]
<?php include_once( $GLOBALS['mosConfig_absolute_path'] . '/webim/chatinclude.php' ); ?>

As i said, it's not the way you should add things to mambo. It's quick and dirty.
« Last Edit: August 02, 2013, 09:50:21 PM by faf »

Yiwu

  • Jr. Member
  • **
  • Posts: 3
Re: Quick&dirty - webIM and mambo
« Reply #1 on: April 15, 2009, 01:57:33 AM »
Ehmm...So good
thanks , good man!