celestine
06-03-2004, 03:27 AM
Hi
I'm coding a forum and would like to disable smilies in between the [ code ] string. Problem is that I have 2 arrays that do the smiley and formatting functions but I can't seem to modify the function to insert the code check in.
$codes = array(
"\n" => "<br />",
'' => '<b>',
'' => '</b>',
'' => '<i>',
'' => '</i>',
'' => '<u>',
'' => '</u>',
'' => '<ol>',
'' => '</ol>',
'' => '<li>',
'' => '</li>',
'' => '<ul>',
'' => '</ul>',
'' => '<div class="code">',
'' => '</div>',
'' => '<center>',
'' => '</center>',
'' => '<strike>',
'' => '</strike>',
'' => '<div class="quote">',
'' => '</div>'
);
$smilies = array(
':)' => 'smile.gif',
':smile:' => 'smile.gif',
':cool:' => 'cool.gif',
':grin:' => 'vhappy.gif',
':D' => 'vhappy.gif',
':sad:' => 'sad.gif',
':wink:' => 'wink.gif',
':b' => 'tounge.gif',
':p' => 'tounge.gif',
':mad:' => 'mad.gif',
':evil:' => 'evil.gif',
':pirate:' => 'pirate.gif',
':grrr:' => 'grrr.png',
':dead:' => 'dead.png',
':wtf:' => 'wtf.png',
':sweat:' => 'llsweatdrop.gif',
':day:' => 'bday.gif',
':lol:' => 'lol.gif',
':cry:' => 'cry.gif',
':bla:' => 'bla.gif',
':o.o:' => 'oO.gif',
':zz:' => 'sleep.gif',
':err:' => 'err.png',
':sleep:' => 'sleep.gif',
':psh:' => 'psh.png',
':shock:' => 'shock.png',
':@.@' => 'twitch.gif',
':ship:' => 'ship.gif',
':love:' => 'love.gif',
':hammer:' => 'hammer.gif',
':Blush' => 'blush.gif',
':clap:' => 'clapping.gif',
':hug:' => 'hug.gif'
);
foreach($codes as $code=>$html) { $tr_entry = str_replace($code, $html, $tr_entry); }
foreach($smilies as $smile=>$image) {
$tr_entry = str_replace($smile, "<img src=\"smilies/$image\">", $tr_entry);
$tr_entry = str_replace("$#39;","'", $tr_entry);
}
can someone enlighten me? thanks for the trouble.
I'm coding a forum and would like to disable smilies in between the [ code ] string. Problem is that I have 2 arrays that do the smiley and formatting functions but I can't seem to modify the function to insert the code check in.
$codes = array(
"\n" => "<br />",
'' => '<b>',
'' => '</b>',
'' => '<i>',
'' => '</i>',
'' => '<u>',
'' => '</u>',
'' => '<ol>',
'' => '</ol>',
'' => '<li>',
'' => '</li>',
'' => '<ul>',
'' => '</ul>',
'' => '<div class="code">',
'' => '</div>',
'' => '<center>',
'' => '</center>',
'' => '<strike>',
'' => '</strike>',
'' => '<div class="quote">',
'' => '</div>'
);
$smilies = array(
':)' => 'smile.gif',
':smile:' => 'smile.gif',
':cool:' => 'cool.gif',
':grin:' => 'vhappy.gif',
':D' => 'vhappy.gif',
':sad:' => 'sad.gif',
':wink:' => 'wink.gif',
':b' => 'tounge.gif',
':p' => 'tounge.gif',
':mad:' => 'mad.gif',
':evil:' => 'evil.gif',
':pirate:' => 'pirate.gif',
':grrr:' => 'grrr.png',
':dead:' => 'dead.png',
':wtf:' => 'wtf.png',
':sweat:' => 'llsweatdrop.gif',
':day:' => 'bday.gif',
':lol:' => 'lol.gif',
':cry:' => 'cry.gif',
':bla:' => 'bla.gif',
':o.o:' => 'oO.gif',
':zz:' => 'sleep.gif',
':err:' => 'err.png',
':sleep:' => 'sleep.gif',
':psh:' => 'psh.png',
':shock:' => 'shock.png',
':@.@' => 'twitch.gif',
':ship:' => 'ship.gif',
':love:' => 'love.gif',
':hammer:' => 'hammer.gif',
':Blush' => 'blush.gif',
':clap:' => 'clapping.gif',
':hug:' => 'hug.gif'
);
foreach($codes as $code=>$html) { $tr_entry = str_replace($code, $html, $tr_entry); }
foreach($smilies as $smile=>$image) {
$tr_entry = str_replace($smile, "<img src=\"smilies/$image\">", $tr_entry);
$tr_entry = str_replace("$#39;","'", $tr_entry);
}
can someone enlighten me? thanks for the trouble.