954,193 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

emoticon integration into shout box

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

nikuki
Newbie Poster
17 posts since Mar 2004
Reputation Points: 10
Solved Threads: 0
 

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 smiley.gif Here is some more info: http://us2.php.net/str-replace

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

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.

nikuki
Newbie Poster
17 posts since Mar 2004
Reputation Points: 10
Solved Threads: 0
 

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

nikuki
Newbie Poster
17 posts since Mar 2004
Reputation Points: 10
Solved Threads: 0
 

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.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

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

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

actually it should be

Zachery
The Geek Father
Team Colleague
894 posts since Nov 2003
Reputation Points: 96
Solved Threads: 21
 

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

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

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

I really new to php :rolleyes:

alina
Newbie Poster
1 post since Mar 2005
Reputation Points: 10
Solved Threads: 0
 
<?php
echo str_replace(":)", "47.gif", "<img src=\":)\">");
?>
dean8710
Junior Poster in Training
54 posts since Jul 2011
Reputation Points: 7
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You