Download (pdf)


Packaging a module for distribution is easy. Just "zip" up the module directory into a compressed archive file. When the ZIP file is installed, the files are copied to the /app/modules/{ModuleName} subfolder of the installation.


All modules should include a manifest in the form of an XML document named the same as the module. This file lines out basic information about the module such as the owner, version, etc. for identification by the installer and then provides optional parameters which may be set in the Module Manager and accessed from within the module's logic to fine tune its behavior. Additionally, this file tells the installer which files should be copied and installed.

A typical module manifest:

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="1.0.0">
	<!-- Name of the Module -->

	<!-- Name of the Author -->

	<!-- Version Date of the Module -->

	<!-- Copyright information -->
	<copyright>All rights reserved by HUBzero 2015.</copyright> 

	<!-- License Information -->
	<license>GPL 2.0</license> 

	<!-- Author's email address -->

	<!-- Author's website -->

	<!-- Module version number -->

	<!-- Description of what the module does -->

	<!-- Listing of all files that should be installed for the module to function -->
		<!-- The "module" attribute signifies that this is the main controller file -->
		<filename module="mod_listnames">mod_listnames.php</filename>
		<!-- Any language files included with the module -->
		<language tag="en-GB">en-GB.mod_listnames.ini</language>
	<!-- Optional parameters -->
		<fields name="params">
			<fieldsset name="basic">
				<!-- parameter to allow placement of a module class suffix for the module table / xhtml display -->
				<field name="moduleclass_sfx" type="text" default="" label="MOD_LISTNAMES_PARAM_CLASS_LABEL" description="MOD_LISTNAMES_PARAM_CLASS_DESC" />

				<!-- just gives us a little room between the previous paramter and the next -->
				<field name="@spacer" type="spacer" default="" label="" description="" />

				<!-- A parameter that allows an administrator to modify the number of users that this module will display -->
				<field name="usercount" type="text" default="5" label="MOD_LISTNAMES_PARAM_USERCOUNT_LABEL" description="MOD_LISTNAMES_PARAM_USERCOUNT_DESC" />

Note: Notice that we DO NOT include a reference in the files section for the XML file.

Let's go through some of the most important tags:

The extension tag has several key attributes. The type must be "module".
You can name the module in any way you wish.
The files tag includes all of the files that will will be installed with the module.
Any number of parameters can be specified for a module.

Last modified: