Topic: EasyBBcode + Extended Smilies Mod (show / hide smiley)
Hey All,
Let me start off by saying I didn't code this myself. I had a programmer code it, so I won't be able to provide too much assistance in troubleshooting. Anywho, here's what I've got:
Mod1: easyBBcode (used Rickard's cool mod)
Mod2: Mofication to easyBBcode mod - Only show the first 11 of about 40 smilies (by defauld the easyBBcode mod shows all smilies)
Mod3: Modification to post.php - Show / Hide "extended" or extra / new smilies
Here is a comparison screenshot of the smilies hidden and showing:
Here is the code for the second mod that shows only the first 11 smilies:
<?php
// Display the smiley set
require_once PUN_ROOT.'include/parser.php';
$smiley_dups = array();
$num_smilies = count($smiley_text);
$m=0;
for ($i = 0; $i < $num_smilies; ++$i)
{
//limit to first 11
if($m>11) break;
// Is there a smiley at the current index?
if (!isset($smiley_text[$i]))
continue;
if (!in_array($smiley_img[$i], $smiley_dups))
{
echo "\t\t\t\t\t\t\t".'<a href="javascript:insert_text(\''.$smiley_text[$i].'\', \'\');"><img src="img/smilies/'.$smiley_img[$i].'" alt="'.$smiley_text[$i].'" /></a>'."\n";
$m++;
}
$smiley_dups[] = $smiley_img[$i];
}
?>
</div>
Here is the code for the show / hide section:
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="80%"><IMG SRC="images/clearpixel.gif" WIDTH=350 HEIGHT=1"><textarea name="req_message" rows="20" cols="95" style="border: solid 1px #a5acb2;" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea></td>
<td width="250" nowrap align="left" valign="top"><?php require PUN_ROOT.'mod_easy_bbcode_PT.php'; ?></td>
</tr>
</table></div>
<!-- end modified block -->
<label><br />
</label>
<ul class="bblinks">
<li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies:'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
</ul>
</div>
</fieldset>
<?php
$checkboxes = array();
if (!$pun_user['is_guest'])
{
if ($pun_config['o_smilies'] == '1')
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];
if ($pun_config['o_subscriptions'] == '1')
$checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['subscribe']) ? ' checked="checked"' : '').' />'.$lang_post['Subscribe'];
}
else if ($pun_config['o_smilies'] == '1')
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];
if (!empty($checkboxes))
{
?>
Hopefully I pulled in all the correct code
Let me know what you think. Do you see any issues with the code / implemenatation?
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews