You are here: C97net • 4. Modules
How to create module's installer for qE
To continue learning about modules, please download demo module. The following information will be based on demo module.
This chapter will cover how to create an installer and share your module.
After you finished your module, you may want to create an installer and share your module.
Gather your module files, use the included _template/ inside demo module to make sure you don't leave out some files. All module files should be placed with the folder structure.
If your module has some .tpl files, make sure to place them inside default/ skin folder. qE will try to load module skin from current skin folder, and then from default skin folder.
And if your module uses other javascript files, make sure to place them inside etc/js/ folder.
A documentation file is a HTML file, without <head> area. It should at least cover installation, uninstallation, usage, skin-modification and copyright notes.
Place your documentation in /admin/module/[mod_name]/info.html.
ini.xml contains [un]installation information for qE. A sample of ini.xml (taken from demo module, removing remarks):
<?xml version="1.0" encoding="iso-8859-1"?>
<qmodule type="module" version="1.0.0">
Initialization. Type should be 'module', and installer version should be '1.0.0'.
<name>Module Demo</name>
<id>demo</id>
<author>C97.net</author>
<copyright>C97.net. All rights reserved.</copyright>
<license>Freeware</license>
<authorEmail>contact@c97.net</authorEmail>
<authorUrl>www.c97.net</authorUrl>
<version>1.0.0</version>
<description>This is a demo. Not a real module!</description>
Self explanatory
<install>
<query>
CREATE TABLE `__PREFIX__demo` (
`idx` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ddate` date NOT NULL DEFAULT '0000-00-00',
`dname` varchar(255) NOT NULL,
`daddress` varchar(255) NOT NULL,
`dsex` char(1) NOT NULL,
`dnotes` text NOT NULL,
PRIMARY KEY (`idx`)
) TYPE=MyISAM;
</query>
MySQL queries for installation. You should use __PREFIX__ which later be replace with proper table prefix.
<folder>demo</folder>
<file>demo/index.html</file>
Empty files & folders to create, relative to admin/ folder.
</install>
<uninstall>
<query>
DROP TABLE `__PREFIX__demo`;
</query>
<file>demo/index.html</file>
<folder>demo</folder>
Uninstallation mysql queries & removing created files & folders.
</uninstall>
<config>
<configId>example</configId>
<configValue>123</configValue>
</config>
Create configuration values to be stored to [prefix]_mod_config. You can later access it from $module_config[mod_name], eg $module_config['demo']
<adminMenu>
<adminTitle>Manage Data</adminTitle>
<adminUrl>task.php?mod=demo&amp;run=edit.php</adminUrl>
</adminMenu>
Create administration menu, which later can be accessed in ACP > Modules > [Mod Name] > [My Menu]
<qsearch>
<note>news search</note>
<table>__PREFIX__news</table>
<title>News</title>
<key>item_id</key>
<url>task.php?mod=demo&amp;item_id=__KEY__</url>
<field>news_id</field>
<field>summary</field>
<field>body</field>
</qsearch>
Create search menu for this module, which later can be accessed from UI.
</qmodule>
For more information for each field, please see demo module.
After creating a module, sharing it is a good way to improve your script. Just like qE, Kemana & Cart2, we have a great benefit by sharing them, we found many new bugs, security issues, which improve the scripts to be better and better.
You can share you script by:
Can I sell my module? Yes, you can. We don't limit you to sell your modules. May be in the future we will create a market place, where you can sell your modules in one place. But for now, if you want to sell your module, you have to provide your own place & payment method to sell it.
There is no comment. Why not be the first?