1

Topic: [mod]Show Smilies In Post Screen

This is easy so I wont bother with a download:

Step 1:
Find:

<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>

and add:

<br />
<br />
<br />
<p>Available Smilies:</p><br />
<iframe src ="http://www.YOURDOMAIN/YOURDIRECTORY/smilies.php" width="80%"> </iframe>

Then make a file called smilies.php. Add to it:

<?php
define('PUN_HELP', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'header.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/help.php';
require PUN_ROOT.'include/parser.php';
$num_smilies = count($smiley_text);
for ($i = 0; $i < $num_smilies; ++$i)
{
if (!isset($smiley_text[$i]))
continue;
echo "\t\t".'    '.$smiley_text[$i];
$cur_img = $smiley_img[$i];
$cur_text = $smiley_text[$i];
for ($next = $i + 1; $next < $num_smilies; ++$next)
{
if (isset($smiley_img[$next]) && $smiley_img[$i] == $smiley_img[$next])
{
echo ' '.$lang_common['and'].' '.$smiley_text[$next];
unset($smiley_text[$next]);
unset($smiley_img[$next]);
}
}
echo ' '.$lang_help['produces'].' <img src="img/smilies/'.$cur_img.'"  alt="'.$cur_text.'" /><br />'."\n";
}
?>

Upload smilies.php to your main forum directory and viol! Your done!


Example: http://www.fatessong.com/forums/post.php?fid=2

2

Re: [mod]Show Smilies In Post Screen

>_<

You find the first code in post.php. Sorry for not being clear.

Re: [mod]Show Smilies In Post Screen

bit dirty tongue iframes aren't allowed, but does the job i guess

4

Re: [mod]Show Smilies In Post Screen

Connorhd wrote:

bit dirty tongue iframes aren't allowed, but does the job i guess

What do you mean by "they aren't allowed?"

I am working on another version that will take them out of the iframe (probably) and make them all clickable.

Re: [mod]Show Smilies In Post Screen

they are invalid markup for punbb, it is xhtml strict which doesn't allow them

6 (edited by Das 2005-07-26 01:30)

Re: [mod]Show Smilies In Post Screen

Well as a temp hack untill I do my next version:

Find

<?php endif; ?>                        <label><strong><?php echo $lang_common['Message'] ?></strong><br />

post.php

After that put:

<div style="width: 400px; height: 100px; overflow: auto">

<?php

$smiley_text = array(
);
$smiley_img = array(
);



$num_smilies = count($smiley_text);

for ($i = 0; $i < $num_smilies; ++$i)

{

    // Is there a smiley at the current index?

    if (!isset($smiley_text[$i]))

        continue;



    echo "\t\t".'    '.$smiley_text[$i];



    // Save the current text and image

    $cur_img = $smiley_img[$i];

    $cur_text = $smiley_text[$i];



    // Loop through the rest of the array and see if there are any duplicate images

    // (more than one text representation for one image)

    for ($next = $i + 1; $next < $num_smilies; ++$next)

    {

        // Did we find a dupe?

        if (isset($smiley_img[$next]) && $smiley_img[$i] == $smiley_img[$next])

        {

            echo ' <b>and</b> '.$smiley_text[$next];



            // Remove the dupe so we won't display it twice

            unset($smiley_text[$next]);

            unset($smiley_img[$next]);

        }

    }

echo "Make" . "<img src=\"/img/smilies/$cur_img\">" .  "<br />";
}

?>

</div>

Rember!

$smiley_text = array(
);
$smiley_img = array(
);

Are arrays you have to edit your self. They can be found in parser.php almost at the top.