View Full Version : emotions
mic2100
04-16-2006, 03:23 PM
I am trying to make a guestbook with PHP and MySQL and i want to add some emotions, does anyone know how i can do this??? Also is there a good place for me to download some of em! I looked on google but didn't have much luck.
Jesters8
04-16-2006, 03:26 PM
most forums use javascript to put codes or punctuation into the text box, such as ::smiley::, then use a string replace function to change them to graphics.
ok, i'll help you a little by giving you actual codes :
Use a function like this one :
function smilies($message){
$message = str_replace(":)","<img src='smileys/smiling.bmp' border=0>", $message);
$message = str_replace(":(","<img src='smileys/sad.bmp' border=0>", $message);
return $message;
}
then on displaying someones guestbook entry, add this :
$message= smilies($message);
and then echo the message to display it , something like this:
echo"$message";
I hope this helps,
Good luck !
Arne
goughy000
04-16-2006, 10:18 PM
Javascript..
<script>
function addSmiley(emoticon)
{
document.form.message.value=document.form.message.value+emoticon;
document.form.message.focus();
return;
}
</script>
<form action="URL HERE" method="POST" name="form">
<a href="javascript: addSmiley(' smilie:alien ')"><img border="0" src="guestbook/smilie/alien.gif"></a>
<textarea rows="10" name="message" cols="60"></textarea>
</form>
felgall
04-16-2006, 10:51 PM
<img src='smileys/smiling.bmp' border=0>
Don't use BMP files on the web because web browsers only understand GIF, JPG, and PNG.
goughy000
04-16-2006, 10:55 PM
Also is there a good place for me to download some of em! I looked on google but didn't have much luck.
Heres mine...
http://www.goughy000.5gigs.com/fotf/guestbook/smilie/
If you had a good luck you would find plenty on google.
mic2100
04-17-2006, 12:30 PM
thanks a lot that really helped
goughy000
04-17-2006, 02:47 PM
your welcome mate :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.