Anatomy of a Module
Module Development (Form Tools 3)
All right! Let's dissect a module. Personally I tend to learn better by viewing an example - so if you're anything like me you might want to take a look at our "Hello World!" example modules as well - that contains three modules you can upload to your Form Tools installation that show off how it works.
All modules are located in the [form tools root]/modules/ folder. Each module has a unique folder name made up of alphanumeric and underscore characters only. For the following page, our module is called "My Module" and its folder is named "my_module". The module name also defines your PHP class namespace, as we shall see.
Required Files & Folders
These files are required for every module. All paths are relative to the module folder, which in our case is
found at [form tools root]/modules/my_module/
.
code/Module.class.php
global/code/Module.abstract.class.php
and contains
the author information, name and description, the module navigation menu, your installation, uninstallation
and upgrade code.
index.php
/templates/index.tpl
templates/
subfolder.
library.php
/lang/en.php
en_us.php
. We use the ISO 639-2 standard for the language
file names.
Optional
smarty_plugins/
The following pages explain each of these files and folders in more depth.