Wednesday, August 18, 2010

How emoticons appear in ASP message boards?

I'm playing about with ASP at the moment and I'm curious to know how, in message boards, how it knows to replace :) or [smile] with an emoticon image?


Are there any tutorials or code snippets explaining how it works?


Cheers!How emoticons appear in ASP message boards?
Some boards are doing it using JavaScript, (to save server resources); but you could do it using a function like preg_replace ( see http://php.net/preg_replace )








In ASP you would do something like:


%26lt;%


RThis = (';Hey replace my smiley :-)';)


RThis = Replace(RThis, ';:-)';, ';%26lt;img src=';';Smiley.png';';%26gt;';)


%%26gt;





%26lt;p%26gt;%26lt;%= RThis %%26gt;%26lt;/p%26gt;








Just replace ';Smiley.png'; with the smiley you want.

No comments:

Post a Comment