Working with Module Templates
Modules that provide user-facing output typically use templates to define and control that output.
Module template files can exist in either the root directory of the module or in a templates subdirectory.
We introduced this in WHMCS 6.0.
You can customize module templates using an overrides system that allows customisations within your active Client Area theme directory. We recommend this for several reasons:
- Customizations remain unaffected through upgrades.
- All of your customisations remain in a centralized location.
- Customizations of module templates are portable with themes.
- Backing up customizations is easier.
To create an override template, make a copy of the original template file within the following directory structure inside your custom template:
For example, in the case of the cpanel provisioning module, you could customize /modules/servers/cpanel/overview.tpl by creating the following template file:
Another example, this time based upon the licensing provisioning module, you can customize /modules/servers/licensing/templates/managelicense.tpl by creating the following template file:
This also applies to addon modules. For example, you can customize the Client Area view template in /modules/addons/project_management/templates/clientview.tpl by creating this template file:
Modules can also provide templates that work with specific Client Area themes.
In WHMCS 8.1 and higher, for example, there are two themes included by default: Twenty-One and Six. Six implements the Bootstrap 3 framework, while Twenty-One uses Bootstrap 4. Because of differences in how they apply styling and structures, a template that works for one may not work for the other. Because of this, WHMCS supports Version Specific Templates.
This allows you to define a default template that has additional templates to use in conjunction with specific system themes. For example, this could provide an older Bootstrap 3-compatible template for use with Six. For more information, see our Developer Documentation on Themes.