Create the folder structure for the module

 

Each module you create must reside inside the <site_root>\includes\ktm\modules\ folder, in a folder of its own. This is needed in order to group the module files in one place, and to allow KTML to load them properly. Create a new folder to store the module. Name it smileys. The folder name is used internally by KTML to access the files composing, so each time you create a module choose a folder name that does not contain any illegal characters for a variable name.

To load the module code, KTML looks for three specific files inside the module root folder:

  1. scripts.js - contains code that works on both Internet Explorer and Mozilla platforms.

  2. scripts_ie.js  - contains JavaScript code that is specific to Internet Explorer platforms.

  3. scripts_mozilla.js - contains JavaScript code that is specific to the Mozilla platform.

Note: You must not put code that is common for both platforms into either scripts_ie.js or scripts_mozilla.js. Instead, place common code into scripts.js.

For this module only create the scripts.js file inside the <site_root>\includes\ktm\modules\smileys\ folder. The other two files are not needed, as the code will work cross-browser.

Smileys are in fact small images that will be inserted through the KTML editor, and displayed in the browser. Therefore, you must first create these images, and place them where the editor can use them. You can create simleys either with a graphics program, or by downloading a pack of free images. Either way, after having the images in one place you must make them available for the module:

  1. Inside the modules/smiley  folder, create a new folder. Name it img. Remember this name as you will use it later on to tell the module where to get the images from.

  2. Copy the images from your disk into this folder. Name each file in a numeric way, zero padded, started with zero (e.g. 00.gif, o1.gif,o2.gif,etc). These names are important as the module will generate them on the fly, using numbers.

Once you are done creating the files and folders, you can move on and create the functions that make up your module.