View Full Version : emoticons

01-20-2003, 05:18 PM
Hi everybody;

I would like to know how the emoticons or the smilies are interpreted when saved into the database and then be viewed when calling them from the database again.

I'm saving my message as follow:
I'm 'mad'
and when viewed
I'm :mad:

So if u have the answer in a website tutorial or u can handle it yourself i would be very thankful.


01-21-2003, 12:51 AM
Something like this?

Function Emote(byVal str)

If IsNull(str) Then Exit Function

Dim EmotedStrings(5)

EmotedStrings(0) = "'mad'"
EmotedStrings(1) = "'happy'"
EmotedStrings(2) = "'sad'"
EmotedStrings(3) = "'embarrassed'"
EmotedStrings(4) = "'laughing'"

Dim Emoticons(5)

Emoticons(0) = "<img src=""images/mad.gif"" width=""15"" height=""15"" />"
Emoticons(1) = "<img src=""images/happy.gif"" width=""15"" height=""15"" />"
Emoticons(2) = "<img src=""images/sad.gif"" width=""15"" height=""15"" />"
Emoticons(3) = "<img src=""images/embarrassed.gif"" width=""15"" height=""15"" />"
Emoticons(4) = "<img src=""images/laughing.gif"" width=""15"" height=""15"" />"

Dim EmoteLoop

For EmoteLoop = 0 to 5
str = Replace(str,EmotedStrings(EmoteLoop),Emoticons(EmoteLoop))

Emote = str

End Function

Dim teststring
teststring = "I am 'mad' today because I am no longer 'happy'. I get 'embarrassed' easily because when I'm 'laughing' it sounds pretty 'sad'."
Response.Write Emote(teststring)

01-21-2003, 01:04 AM
That's what i was looking for, thank you my friend