rendered paste body function emoticons($string)
{
$query = "SELECT * FROM forum_emoticons";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
$img_code = $row["img_code"];
$img_name = $row["img_name"];
$img_path = "images/emoticons/" . $img_name;
if(!file_exists($img_path))
continue;
$emoticon = "<img src=\"" . $img_path . "\" border=\"0\">";
$string = str_replace($img_code , $emoticon , $string);
}
return $string;
}
// usage (in forum class):
$str = $forum->emoticons($str);