 |
 |
 |
 |
#315254 - 08/17/07 10:36 PM
[7.2.1] - Naked shoutbox
|
Bada bing!
Enthusiast
Registered: 11/08/03
Posts: 439
Loc: SoCal
Add to del.icio.us
Digg it
|
The shoutbox has been a problem for some sites in that it was perceived to be causing issues on boards ranging from small 'hiccups' to 'catastrophic whatever'. Some people suggested the idea of opening the shoutbox in it's own window.. Hence the 'naked shoutbox' is born: Steps to implement: create a new file called nakedshout.tpl past the following into it: {* Script Version 7.2.1 *}
{* SD - Mod: The naked shoutbox is born! *}
<html>
<head>
<link rel="stylesheet" href="{$stylesheet}" type="text/css" />
<script type="text/javascript" src="{$config.BASE_URL}/ubb_js/ubb_jslib.js"></script>
<script type="text/javascript" src="{$config.BASE_URL}/ubb_js/shoutbox.js"></script>
<script language="javascript" type="text/javascript">
var confirmText = "{$lang.CONFIRM}";
var notLogged = "{$lang.NO_SHOUT}";
var baseurl = "{$config.BASE_URL}";
var fullurl = "{$config.FULL_URL}";
var imagedir = "{$style_array.general}";
var myUid = '{$myid}'; // Don't get excited, you can't exploit this :D
var submitClicked = "{$lang.SUBMIT_CLICKED}";
</script>
<title>Naked Shout - powered by UBB.threads™</title>
</head>
<body>
<table width="810px" height="610px" cellpadding="0" cellspacing="0" border="0">
<tr><td>
{$tbopen}
<tr>
<td class="tdheader">{$lang.SHOUT_BOX}</td>
</tr>
<tr>
<td class="alt-1">
<div id="shout_box" style="height:600px; width: 800px; overflow:auto;">
<div id="shout_content" style="height: 584px;">
</div>
</div>
<form name="shoutbox" method="post" action = "" onsubmit="shoutit();return false;">
<div align="center">
<span id="shout_field">
<input type="text" name="shoutbody" size="80" class="form-input" maxlength="255" value="" onenter="shoutit()" />
</span>
<span id="sending_field" style="display:none">
Sending...
</span>
<br />
<input type="button" name="shoutbutton" value="{$lang.SHOUT_IT}" class="form-button" onclick="shoutit()" />
<input type="reset" value="{$lang.RESET_IT}" class="form-button" />
</div>
<div id="shout_uid" style="display:none;">
Delete this shout?<input type="button" class="form-button" id="del_yes" value="Yes" /><input type="button" class="form-button" id="del_no" value="No" />
</div>
</form>
</td>
</tr>
{$tbclose}
</td></tr></table>
<script type="text/javascript">getShouts(0);</script>
</body>
</html>upload to /templates/default directory Step 1 - Done! create a new file called nakedshout.inc.php paste the following into it:
<?php
if(!defined("UBB_MAIN_PROGRAM")) exit;
function &page_nakedshout_gpc () {
return array(
"input" => "",
"wordlets" => "" ,
"user_fields" => "",
"regonly" => 1,
"admin_only" => 0,
"admin_or_mod" => 0,
);
} function &page_nakedshout_run () {
global $style_array,$smarty,$user,$in,$ubbt_lang,$config,$forumvisit,$visit,$dbh,$var_start,$var_eq,$var_sep,$var_extra;
extract($in, EXTR_OVERWRITE | EXTR_REFS); $smarty_data = array();
define('NO_WRAPPER',1);
$stylesheet = "{$config['BASE_URL']}/styles/{$style_array['css']}";
$smarty_data = array(
"stylesheet" => $stylesheet,
"myid" => $user['USER_ID'],
);
return array(
"header" => array (
"title" => "",
"refresh" => 0,
"user" => $user,
"Board" => "",
"bypass" => 0,
"onload" => "",
"breadcrumb" => "",
),
"template" => "nakedshout",
"data" => & $smarty_data,
"footer" => false,
"location" => "",
);
}
?>
upload to /scripts dir.. Then you can decide to put a link to it anywhere you want. I chose to add it to the header.tpl and make it part of 'My Stuff' menu, but you can do whatever you want. the header.tpl code is:
{* SD - Mod (My Shouts) *}
<tr><td class="popup_menu_content">
<a href="{$config.BASE_URL}/ubbthreads.php{$var_start}ubb{$var_eq}nakedshout" target="_blank">My Shoutbox</a>
</td></tr>added after the 'My Posts' stuff. the KEY thing to note is the URL. namely http://yourboard/url/ubbthreads.php?ubb=nakedshout (add target="_blank", if you want a new window) and you are done. Notes: - you can disable your shoutbox in the portal and this will still run fine.
- feel free to change the .tpl heights and widths to your liking. i made mine a large window
- you can also edit /ubbt_js/shoutbox.js and change the update frequency to less than 30secs.. find:
function startTimer(){
shoutTimer = setTimeout("getShouts()",30000);
} and change the 30000 to whatever number of milliseconds you want. ie: if you want 5seconds, the number will be 5000.
Keep in mind of the burden on your board. Most shoutboxes aren't too lively, so i had no problem setting it to 5secs 
Oh and here's some screenies (note: livewell is just a lang file for my favorite customer - Mitch P !):  and  and  upload all files and *poof* done! enjoy, SD
_________________________
A taxpayer voting for Obama is like a chicken voting for Colonel Sanders.
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|