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".
Required Files & Folders
These files are required for every module. All paths are relative to the Form Tools root.
This file contains information about your module: the author information, name and
description, and the module navigation menu.
The first page the administrator will be linked to when clicking on the module in
the Modules listing page.
All modules require a language file in the language of the developer. For US English,
this file would be called en_us.php. This uses the ISO 639-2 standard for the language
file names. This language file contains (at minimum) the module name and module description.
All HTML in Form Tools is rendered via Smarty templates. This provides enormous power
to the developer, but can be admittedly a little tricky at first. Your module will
need to define at least one Smarty template to render the index.php page. Other than
the required .tpl extension, you can call it what you want (index.tpl isn't required)
and store it wherever you want within your module folder. For simple modules, putting
the .tpl (template) files in the same folder as the PHP isn't much of a sin, but for
larger modules, separating it into a templates/
folder may be a good
Optional Files & Folders
This file is needed if you need to do any of the following: include an installation
function, uninstallation function, use hooks
need to access your module in the main script.
Any Smarty functions and modifiers should be placed in this subfolder. Depending on
the content and scope of your module, this may not be needed. But if you
and need to access them in pages in the core script, you will need to
define them here.
The following pages explain each of these files and folders in more depth.