Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting smiley into the HTML

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.

like image 442
mihsathe Avatar asked Dec 09 '10 04:12

mihsathe


2 Answers

Insert &#x263A 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)

like image 155
Carrotman42 Avatar answered Oct 06 '22 00:10

Carrotman42


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.

like image 25
You Avatar answered Oct 06 '22 01:10

You