How can i add smileys to my website?

Discussion in 'PHP' started by mongolpunctro, Mar 1, 2009.

  1. #1
    This is the leastest thing i have to do for my website and i don't know how :(

    How can i make my php website to intepretate smileys? I mean, when you post a message with ": )" to apear the smile face " :) " is this possible?

    Thanx.
     
    mongolpunctro, Mar 1, 2009 IP
  2. SISKO

    SISKO Peon

    Messages:
    9
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i would do it like this

    $text=eregi_replace(":)","<img src='images/smile.gif'",$text);

    echo $text;
     
    SISKO, Mar 1, 2009 IP
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Simple str_replace will do since there is no uppercase / lowercase for symbols.

    - ads2help
     
    ads2help, Mar 1, 2009 IP
  4. mongolpunctro

    mongolpunctro Greenhorn

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    Thank you guys...

    But can i do it for two symbols? for example if i want " : - ) " to show the same smiley like " : ) ".
     
    mongolpunctro, Mar 1, 2009 IP
  5. mongolpunctro

    mongolpunctro Greenhorn

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    is this code correct?

    str_replace(': )', '<img src="smile.gif" alt=": )" />', $postedMessage);
     
    mongolpunctro, Mar 1, 2009 IP
  6. kittyluver

    kittyluver Notable Member

    Messages:
    6,812
    Likes Received:
    222
    Best Answers:
    0
    Trophy Points:
    263
    #6
    My simple method is- I'll copy the image in DP forum threads and paste in the wordpress writing page especially in between the article. That's all!!! :) Thanks to DP forums!!!
     
    kittyluver, Mar 1, 2009 IP
  7. mongolpunctro

    mongolpunctro Greenhorn

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    That works ok in wordpress, but my website is php custom made, and i wanted the smyles, to apear for the visitors...:(
     
    mongolpunctro, Mar 1, 2009 IP
  8. SISKO

    SISKO Peon

    Messages:
    9
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    yep, it seems correct
     
    SISKO, Mar 1, 2009 IP