maxudaskin Posted March 8, 2008 Share Posted March 8, 2008 Is it possible to 'filter' a string using an array of what I called shortcuts and image locations and have the location replace the shortcut (if found)... For example; "Hi! : )" would show "Hi! ". Quote Link to comment Share on other sites More sharing options...
peranha Posted March 8, 2008 Share Posted March 8, 2008 // Smilies Replace Code. $smiles = array("D:(","D:D","0:)","|","","|","","","","","","","","???","","",":-X",":-U","",":-(","^-^","00","P)","P:O"); $replacements = array('<img src=smilies/yellow/angry.gif>','<img src=smilies/yellow/evil.gif>','<img src=smilies/yellow/angel.gif>','<img src=smilies/yellow/smile.gif>','<img src=smilies/yellow/rolleyes.gif>','<img src=smilies/yellow/razz.gif>','<img src=smilies/yellow/sad.gif>','<img src=smilies/yellow/smiley.gif>','<img src=smilies/yellow/wink.gif>','<img src=smilies/yellow/cheesy.gif>','<img src=smilies/yellow/grin.gif>','<img src=smilies/yellow/shocked.gif>','<img src=smilies/yellow/cool.gif>','<img src=smilies/yellow/huh.gif>','<img src=smilies/yellow/tongue.gif>','<img src=smilies/yellow/embarrassed.gif>','<img src=smilies/yellow/lipsrsealed.gif>','<img src=smilies/yellow/undecided.gif>','<img src=smilies/yellow/kiss.gif>','<img src=smilies/yellow/cry.gif>','<img src=smilies/yellow/azn.gif>','<img src=smilies/yellow/afro.gif>','<img src=smilies/yellow/eyepatch.gif>','<img src=smilies/yellow/police.gif>'); That is what I use and call it like this $string = str_replace($smiles,$replacements,$string); Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted March 8, 2008 Author Share Posted March 8, 2008 Where'd you get your smilies from? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 8, 2008 Share Posted March 8, 2008 All over the net, just do a google search. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.