To add your own smileys/emoticons the most easy way is to replace the existing icon images (in the images folder in the gbook folder). But as a result you will lose the existing icon.
To add new smileys you will have to edit two files, the smileys.htm file and the gbook.php file.
smileys.htm file
In the smileys.htm file an icon is displayed and linked with a line similar like the following
Code: Select all
<a href="javascript:void(0)" onClick="Javascript:insertSmiley(':smiley01:');return false;"><img src="images/smiley01.gif" border="0" alt=""></a>
gbook.php file
In the gbook.php file the function which parses the comments entry and replaces the inserted smiley text-string with a link to the image to be displayed starts at line 305 function processsmileys($text) {.
When you add a new image in the smileys.htm file you will also have to add it to this function. To do this you will have to add a line like this:
Code: Select all
$text = preg_replace("/\:smiley01\:/i","<img src=\"images/smiley01.gif\" border=\"0\" alt=\"\">",$text);
In this example i have used the same name for the image and the inserted code. These don't have to be the same but it makes it a lot easier to read and write. However, the text-string inserted by smileys.htm must be the same as in the gbook.php function and also the image links should be the same.
Also you should be careful with using special characters in the code to be inserted. Some characters can not be used and some characters have to be treated special because they have special meanings in php code.
I will try to explain what i mean.
For example, you can simply insert a : in smileys.htm but you have to put \: in gbook.php to be parsed properly. This is also true for for example / [ ( and some more characters (if you try them yourself you will see what happens).
And sometimes you will have to use the named character instead of the actual character. For example when you use < in smileys.htm, you will have to put < in gbook.php
For an overview of named characters see the following link http://www.leeanne.com/usinghtml/htmlnamedentities.html
I hope this explanation is clear enough, if not post your question in this topic.
Greetings,
Henrie