Monkuar Posted February 18, 2012 Share Posted February 18, 2012 My Smilieys: $smilies = array( '' => 'smile.gif', '=)' => 'smile.png', ':|' => 'neutral.png', '=|' => 'neutral.png', '' => 'sad.png', '=(' => 'sad.png', '' => 'big_smile.png', '=D' => 'big_smile.png', '' => 'yikes.png', '' => 'yikes.png', '' => 'wink.png', ':/' => 'hmm.png', '' => 'tongue.png', '' => 'tongue.png', '' => 'lol.png', ':mad:' => 'mad.png', '' => 'roll.png', ':cool:' => 'cool.png'); My function to convert: function do_smilies($text) { global $pun_config, $smilies; $text = ' '.$text.' '; foreach ($smilies as $smiley_text => $smiley_img) { if (strpos($text, $smiley_text) !== false) $text = ucp_preg_replace('%(?<=[>\s])'.preg_quote($smiley_text, '%').'(?=[^\p{L}\p{N}])%um', '<img src="'.pun_htmlspecialchars(get_base_url(true).'/img/smileys/'.$smiley_img).'" alt="'.substr($text, 0, strrpos($text, '.')).'" />', $text); } return substr($text, 1, -1); } I am trying to make the alt='' Can you help me please? I tried $text, but then it just foreaches it and converts it again Im trying to put the smiley code inside the alt tag. Quote Link to comment https://forums.phpfreaks.com/topic/257272-help-please/ 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.