Widget:Advanced iframe

From Mibbit Wiki
Revision as of 16:03, 29 November 2008 by Azander (Talk | contribs)

Jump to: navigation, search

Here an example how to integrate the Mibbit widget into your site (stored as "myMibbit.php"):

 // default: irc.mibbit.com 
 $server = 'irc.freenode.net'; 
 $room   = 'MibChat'; // w./o. # or %23 !
 $uri    = 'http://widget.mibbit.com/'
 . '?nick=Wdg_%3F%3F%3F%3F' // ?=%3F will be replaced by a digit 
 . "&customprompt=Welcome%20to%20$server/$room"
 . '&customloading=maybe%20you%20need%20to%20close%20other%20Mibbit%20windows%20first...'
 . '&settings=c76462e5055bace06e32d325963b39f2'; 
 if (!empty($room))    {$uri .= '&channel=%23' . $room;}  
 if (!empty($server )) {$uri .= '&server='     . $server;}  
 // IE needs a proper header:
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>my chat on <?php echo empty($server)  ? 'irc.mibbit.com' : $server; ?></title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
body{font:93% verdana,sans-serif;background:#999;color:#fff;}
iframe{width:500px;height:400px /* "%" doesn't work in strict mode! */;}
<h3>advanced embedded mibbit widget example</h3>
<iframe  src="<?PHP echo $uri; ?>" frameborder="0">
 [Your user agent does not support frames or is currently configured
 not to display frames. However, you may want to open the
 <A href="<?PHP echo $uri; ?>"
 target="_blank"> chat in a new browser window ...</A>]
<br>(no spaces, interpunctuation or leading ciphers in your /nick name)
<h4>type /help to learn about special commands</h4>

if you link/open this in a new window you avoid unintentional leaving the chat when hitting the back button/key:

<a href="myMibbit.php" target="_blank">myMibbit</a>