943,779 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 8454
  • PHP RSS
Apr 3rd, 2004
0

emoticon integration into shout box

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nikuki is offline Offline
17 posts
since Mar 2004
Apr 3rd, 2004
0

Re: emoticon integration into shout box

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
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Apr 3rd, 2004
0

Re: emoticon integration into shout box

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nikuki is offline Offline
17 posts
since Mar 2004
Apr 3rd, 2004
0

Re: emoticon integration into shout box

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nikuki is offline Offline
17 posts
since Mar 2004
Apr 3rd, 2004
0

Re: emoticon integration into shout box

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.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Apr 4th, 2004
0

Re: emoticon integration into shout box

Make sure your code is compatible with more browsers than just IE. And Dani, the code should be: <img src="smiley.gif" /> :p
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Apr 4th, 2004
0

Re: emoticon integration into shout box

actually it should be

<img src="smilie.gif" alt="" />
Team Colleague
Reputation Points: 96
Solved Threads: 21
The Geek Father
Zachery is offline Offline
781 posts
since Nov 2003
Apr 5th, 2004
0

Re: emoticon integration into shout box

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

Besides, come to think of it, there's anotherr new standard which is something like <object type="image/gif" src="smilie.gif" alt="Smile!" />
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Mar 27th, 2005
0

Re: emoticon integration into shout box

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

I really new to php :rolleyes:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
alina is offline Offline
1 posts
since Mar 2005
Dec 30th, 2011
-1
Re: emoticon integration into shout box
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. echo str_replace(":)", "47.gif", "<img src=\":)\">");
  3. ?>
Reputation Points: 7
Solved Threads: 2
Junior Poster in Training
dean8710 is offline Offline
51 posts
since Jul 2011
Message:
Previous Thread in PHP Forum Timeline: Mail form does not work
Next Thread in PHP Forum Timeline: $.Ajax and JSON





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC