Chapter 9. Creating modules

Table of Contents
Module structure
Creating fully compatible modules: the rules to follow
Module creation, the public part
Module creation, administrator part

Module structure

The PHP-Nuke modules are PHP-written applications that manage the central part of the site. For example, the "News", "Forum", "Members List" etc. are all modules. Each module, based on it's complexity, is structured using one part for the user's and another for the administrator, in this case there are some contents we have to modify. It's all managed from the modules.php file which alone, carries out the job of authentication and management of the access rights on that module. The modules.php file checks and verifies if the module was activated or not, and verifies the access rights. This saves us a lot of work because we don't have to insert these controls in every module we create.

We refer you to what is written in the Section called Module management in Chapter 6 to be more exhaustive.

For example in the avantgo module, in order to load the index.php file, it's enough to pass the module name to the parameter string, the file that will be searched for is index.php.

modules.php?name=AvantGo

If instead we wanted to call a page different from the default index.php (say, print.php), the string we will have to pass is :

modules.php?name=AvantGo & file=print

That is the file variable with a value (print) that corresponds to the name of the file we want to load without the .php extension.

Inside of the folder modules/nameofmodule there is also a subfolder called "language". In this fashion we manage in a simple and immediate way the multilanguage functionality inside the modules.

The rows modules.php work in this way: