I recently added a shout box to my page and I am interesting in adding emoticons. I have searched around and found no standalone emoticon script, at least none that I could get to work.

I would appreciate any suggestions on how to add emoticons to my shout box script.

Thanks


www.nikuki.com

Suppose a user enters something and it is stored as a string. Run the php function str_replace on that string before posting. Each time you find the sequence :) then replace it with <img src="smiley.gif">

Here is some more info: http://us2.php.net/str-replace

thanks

i'm so new to PHP... sometimes i have to look at many different example to be able to wrap my mind around something!

that link really helped me.

ok, so now, i want to offer a page with a list of all emoticons and let the user click on one to add it to their post... like on www.skinbase.org

Create a table with all of the different icons as images. Use javascript (sorry, I don't know the language enough to provide sample code, but it shouldn't be difficult at all) so that when an image is clicked on, it adds the text equivalent of the smilie to the textbox. When the user clicks submit, the php file will run the str_replace function and make it into an image.

Make sure your code is compatible with more browsers than just IE. And Dani, the code should be: <img src="smiley.gif" /> :p :)

actually it should be

<img src="smilie.gif" alt="" />

Well if you wanna be like that, you should have included some alt text. :P

Besides, come to think of it, there's anotherr new standard which is something like <object type="image/gif" src="smilie.gif" alt="Smile!" />

hi..
can u give me an example for that script ? (adding emoticons to a shoutbox)

I really new to php :rolleyes:

<?php
echo str_replace(":)", "47.gif", "<img src=\":)\">");
?>
commented: please stop resurrecting dead posts -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.