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:

http://www.backyardchickens.com/images/smiliey.gif


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?

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

Re: EasyBBcode + Extended Smilies Mod (show / hide smiley)

First of all what is this file: mod_easy_bbcode_PT.php
Secondly, where in post.php does the second part of your code go?

very confusing....

3 (edited by reviewum.com 2007-03-20 02:38)

Re: EasyBBcode + Extended Smilies Mod (show / hide smiley)

bingiman, yeah, I know it's confusing, sorry.  I posted the info in the hopes that some of the coders on this forum would either:

1)  Use it as it is, or hack it to work on their systems
2)  Clean it up and turn it into a real modification

Again, I'm very far from being a programmer... I'm the idea / implementation guy that puts stuff together.  I was simply posting what I believe are the mods my programmer implemented in an effort to give back to the community.

Your first question:  mod_easy_bbcode_PT.php:  Good catch!  This is actually my modded mod_easy_bbcode.php file so I can revert to the original easybbcode mod if I need to.

Your second question:  I didn't put the line / code # where this mod begins as I didn't want people who didn't know what they were doing to implement it and come back yelling at me that it didn't work.  Hope that makes sense.

Again, it would be cool if one of the programming genius types wanted to take the foundation I have above and turn it into a mod or two... just sharing what I've got available to help out this great community!

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews