Ask HN: How to design private messaging emoticons?
I have a social networking site that I have coded myself. I have an option there for members to send comments back and forth to each other. I want to enable 'emoticons'; but I am not sure how to do that.. Do I just put some 'special tags' in the comment and then decode while displaying? can someone offer any input on this?
8 comments
[ 5.3 ms ] story [ 28.7 ms ] threadThat said, implementing said emoticons is a simple task. Assign a list of emoticon codes and image files (eg. ":)" => "smile.gif" and ":D" => "grin.gif") either hardcoded or in a database table depending on your needs, and use a simple search-and-replace function to replace the emoticon code with an image tag of the file. Make sure this is done when the message's body is parsed, and NOT before it gets inserted into the database.