How do I insert a smiley in the HTML programatically? I want to know the logic as how does it exist along with text? Is it a styled ASCII character or something? thanks in advance.
Insert ☺
into an html document to render a smiley.
Comes out like this: ☺
It renders like this because it is a unicode character (See http://en.wikipedia.org/wiki/Smiley)
Assuming you mean smilies as found in various forums, you simply replace the ASCII smiley with a HTML img
element on the server side. The output will look like this:
<p>This is a paragraph <img src="wink.png" alt=";)"></p>
Most of the time this is achieved using e.g. the PHP str_replace
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With