7. Module Management

Trex offers a facility called “Module Management”, it saves yourself the tedious work of creating an interface for managing modules. Remeber that with Trex you build an Admin site on a per-module basis.

The Admin site is not enabled by default, it’s an opt-in thing. To enable the Admin site for your project, open the SiteConfig.php file and set the “admin_enabled” option to true.

7.1. Module Management Panel

Once the Admin site is enabled, you can manage the modules from the Admin interface of your Project. The “Module Management” panel lists all the public modules found in the modules/ directory. If a module is installed and becomes active, you’ll see a description of what it does, an author, a website to refer to, and a version number. If you do not see the module on the list, it can be that:

  • The module is missing the action controller (e.g.: modules/news/News.php).
  • The module is protected (e.g.: modules/_news/News.php).

In Trex, protected modules always start with an underscore “_” and cannot be activated using the Admin Interface.

7.2. Module Installation

To install a module:

  • Upload the module to the modules/ folder.
  • Access the “Module Management” panel in your Admin site.
  • Scroll down through the list of Modules to find the newly installed Module.
  • Click on the Activate link to install and enable the module.

A Module can have an installer file located in the modules/<module_name>/config/ folder. The installer file is named <module_name>Install.php and it’s used by Trex to create the database schema. Installers will allow you to define your database tables and columns independently from the database vendor.

[edit]