Here is the simplest way to show emoticons, without separate control from admin control panel. Its just replace special codes like " : ) ; ) " with image.
-------------------------------------------------------------------
example:
http://come.no-ip.com/details.php?image_id=7570&page=2#comments-------------------------------------------------------------------
Step 1.Open
/includes/functions.phpFind:
$text = preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU", "<u>\\5</u>", $text);
Add right after it ( before "
} "):
$text = smilies($text);
1.2Add at the end of the file, just before
?> :
//--------------------------
//--------Smiles------------
//--------------------------
function smilies($text,$enablesmilies = 1) {
global $smileyfromcache, $smileytocache;
$imagesdir = TEMPLATE_PATH."/smiles";
if(gettype($smileyfromcache) != "array") {
$smilesfrom = array(
":)" => "smiley",
";)" => "wink",
":D" => "cheesy",
";D" => "grin",
":(" => "sad",
":o" => "shocked",
":O" => "shocked",
"8)" => "cool",
":P" => "tongue",
":p" => "tongue",
"???" => "huh",
":-[" => "embarassed",
":-X" => "lipsrsealed",
":-x" => "lipsrsealed",
":-'(" => "cry",
":-\\" => "undecided",
"::)" => "rolleyes"
);
foreach ($smilesfrom as $key => $val) {
$smileyfromcache[] ='/(((>[^<]*)|(^[^<]*))([\s\n\r]|^|<br( \/)?[>]))('.str_replace('|','\|', quotemeta(str_replace("<", "<", str_replace(">", ">", str_replace("\/", "\\\/", $key))))).')/s';
$smileytocache[] = "\\1<img src=\"$imagesdir/$val.gif\" alt=\"\" border=\"0\">";
}
}
if ($enablesmilies) {
$text = parsesmilies($text);
}
return $text;
}
function parsesmilies($text) {
global $smileyfromcache, $smileytocache;
$oldtext = "";
while($oldtext != $text) {
$oldtext = $text;
$text = preg_replace($smileyfromcache, $smileytocache, $text);
}
return $text;
}
//------End Smiles-------
Step 2.Create new folder:
/templates/<yourtemplate>/smiles/. Upload your smiles.
U can download "sample" :roll: smiles pack from
here2.2.Edit
$smilesfrom array with this format:
"CODE" => "FILENAME"
* CODE is a code for your emoticon, e.i ; ) or : D
* FILENAME is name of the file u want use for that emoticon, WITHOUT extension.
NOTE:1. All images must be
.gif2. All items in the array, MUST have comma at the end (e.i "CODE" => "FILENAME"
, And ONLY last item in the array MUST
NOT have the comma.