Difference between revisions of "Widget:Advanced iframe"

From Mibbit Wiki
Jump to: navigation, search
m
(new widget features)
Line 1: Line 1:
 
here an example how to integrate a chat window into your site (stored as "myMibbit.php"):
 
here an example how to integrate a chat window into your site (stored as "myMibbit.php"):
 
  <nowiki>
 
  <nowiki>
 +
 +
</nowiki>
 +
if you link/open this in a new window you avoid unintentional leaving the chat when hitting the back button/key:
 
<?PHP
 
<?PHP
  $uri = 'http://embed.mibbit.com/'  
+
// default: irc.mibbit.com
  . '?nick=emb' // or $_SESSION['LoginName'] if available; must not start numeric
+
$server = 'irc.freenode.net';
. mt_rand(100000, 999999)   // avoid collisions
+
$room  = 'test'; // w./o. # or %23 !
  . '&chatOutputShowTimes=true' // type /dset for more settings
+
  $uri   = 'http://embed.mibbit.com/'
  . '&server=irc.freenode.net// or any server; comment this line for irc.mibbit.com
+
  . '?&forcePrompt=true&nick=prefix' . mt_rand(10000, 99999)
  . '&channel=%23test';         // or %23yourChannel
+
. '&needSendButton=true'      // some mobile phones need it
// the following DOCTYPE ... strict.dtd is important for IE and Opera to work as intended! ...
+
. '&tabFontFamily=verdana,sans-serif'
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
  . '&chatOutputShowTimes=true'; // type /dset for more settings
<html>
+
  if (!empty($room)) {$uri .= '&channel=%23. $room;
<head><title>my chat on freenode</title>
+
  if (!empty($server )) {$uri .= '&server='     . $server ;
 +
?><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'/>
 
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
 
<style>
 
<style>
body{
+
body{font:93% verdana,sans-serif;background:#999;color:#fff;}
  font:93% Arial,sans-serif;  
+
iframe{width:96%;height:75% /* % doesn't work in strict mode*/;}
  background:#666; color:#fff;
 
}
 
iframe{
 
  width:96%;
 
  height:400px;
 
}
 
 
</style>
 
</style>
 
</head>
 
</head>
 
<body><center>
 
<body><center>
<h3>type /help to learn about available commands</h3>
+
<h3>IRC server: <?php echo empty($server)  ? 'irc.mibbit.com' : $server; ?></h3>
<iframe  src="<?PHP echo $uri; ?>" scrolling="no" frameborder="0">
+
(start channel: <?php echo empty($room) ? '#chat' : '#' . $room; ?>)
 +
<iframe  src="<?PHP echo $uri; ?>" frameborder="0">
 
  [Your user agent does not support frames or is currently configured
 
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may want to open the  
+
  not to display frames. However, you may want to open the
 
  <A href="<?PHP echo $uri; ?>"
 
  <A href="<?PHP echo $uri; ?>"
 
  target="_blank"> chat in a new browser window ...</A>]
 
  target="_blank"> chat in a new browser window ...</A>]
 
</iframe>
 
</iframe>
 +
<br>(no spaces, interpunctuation or leading ciphers in your /nick name)
 +
<h4>type /help to learn about available commands</h4>
 
</center></body></html>
 
</center></body></html>
</nowiki>
 
if you link/open this in a new window you avoid unintentional leaving the chat when hitting the back button/key:
 
 
 
  <nowiki><a href="myMibbit.php" target="_blank">myMibbit</a></nowiki>
 
  <nowiki><a href="myMibbit.php" target="_blank">myMibbit</a></nowiki>
 
-- [[User:HerculeP|HerculeP]] March 2008
 
-- [[User:HerculeP|HerculeP]] March 2008

Revision as of 21:48, 28 March 2008

here an example how to integrate a chat window into your site (stored as "myMibbit.php"):


 

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

// default: irc.mibbit.com 
$server = 'irc.freenode.net'; 
$room   = 'test'; // w./o. # or %23 !
$uri    = 'http://embed.mibbit.com/'
. '?&forcePrompt=true&nick=prefix' . mt_rand(10000, 99999)
. '&needSendButton=true'       // some mobile phones need it
. '&tabFontFamily=verdana,sans-serif'
. '&chatOutputShowTimes=true'; // type /dset for more settings
if (!empty($room)) {$uri .= '&channel=%23'  . $room;}  
if (!empty($server )) {$uri .= '&server='      . $server ;}  

?><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'/> <style> body{font:93% verdana,sans-serif;background:#999;color:#fff;} iframe{width:96%;height:75% /* % doesn't work in strict mode*/;} </style> </head>

<body>

IRC server: <?php echo empty($server)  ? 'irc.mibbit.com' : $server; ?>

(start channel: <?php echo empty($room) ? '#chat' : '#' . $room; ?>) <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>]

</iframe>
(no spaces, interpunctuation or leading ciphers in your /nick name)

type /help to learn about available commands

</body></html>

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

-- HerculeP March 2008