Jump to content

help please


Monkuar

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/257272-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.