Customizing

phpFreeChat was developped with an aim of simplicity and flexibilty.

Setting it up is relatively simple. All parameters are centralized in an array and passed as parameters on the instantiation of the phpFreeChat object.

We can thus :

Customization of the overall appearance (colors, sizes ...)

You need to create a new theme (for example mytheme) :

  1. Create a directory: phpfreechat/themes/mytheme/
  2. Create a new CSS stylesheet: phpfreechat/themes/mytheme/style.css
  3. Now insert CSS rules into this file, for example, to change the date/hours color to red:
    span.pfc_heure, span.pfc_date {
      color: red;
    }
  4. Setup the theme parameter in your chat script:
    $params["theme"] = "mytheme";

As an examples, see these demos: 1, 2

Customization of the smileys list

Follow the above instructions for the theme creation. Then I suppose you have a directory phpfreechat/themes/mytheme/.

  1. Create a new smileys directory: phpfreechat/themes/mytheme/smileys/
  2. Insert ping, jpeg or gif smileys images in the folder for example : smiley1.png, smiley2.gif, and smiley3.jpg
  3. Create a file phpfreechat/themes/mytheme/smileys/theme and enter the keyboard to image mapping smileys' description, for example :
    smiley1.png :) :-)
    smiley2.gif :( :-(
    smiley3.jpg :D :-D :o)

    Each line begins with the image filename followed by the list of the string characters to replace by that image. Only use spaces to separate the smileys string matches.

  4. Setup the theme parameter in your chat script:
    $params["theme"] = "mytheme";

As an examples, see these demos: 1, 2, 3, 4

Write a new command

A command is a php classe. So, to write your own command, you need to write a new php classe (as an example look at the src/commands/nick.class.php file).

Each command class inherite from a virtual pfcCommand class. This virtual class define the command interface. Currently the only virtual method to implement is: function run(...)

You have some API you can use to write your command:

@todo : to write

As an examples, have a look to this demo: 1 (try to type /roll 2d6)

Write your own container

@todo : to write

As an examples, have a look to the default file container source code.