Since I have been studying the xoops module for the past two days, I found this good module development quick start.
After reading it, I came to the development module with great interest, but encountered some problems during the development process.
I think it's too fast to learn. Therefore, the translation is here.
====================
Author: surance Yin
Email: Suranceyin@yahoo.com.cn
Home: http://www.fltek.com.cn
========================
Create a simple module
index
- basic content of the module
- Create a list
- Create a MySQL table
- use forms and databases
- display database data
|
This Quick Start teaches you how to create a simple module . Step 1: Download the blank module on the right. . |
tutorial module tutorial |
The basic content of the module.
Open the blank module and you will see 2 Items PHP File, Images Folder, which contains an image-this is the beginning of a module. Use one PHP Open Editor Xoops_version.php. You can use the image Dreamweaver The WYSIWYG editor can also be used. PHP designer Or Maguma Open Studio ( All are free of charge ).
// Quick Start module // kaotik published $ Modversion ['name'] = "tutorial "; $ Modversion ['version'] = 1.00; $ Modversion ['description'] = "this is a tutorial module to teach how to build a simple module "; $ Modversion ['author'] = "kaotik "; $ Modversion ['credits '] = "kaotik "; $ Modversion ['help'] = ""; $ Modversion ['license '] = "GPL see license "; $ Modversion ['official '] = 0; $ Modversion ['image'] = "images/tutorial.png "; $ Modversion ['dirname'] = "tutorial "; // Admin $ Modversion ['hasadmin'] = 0; // Menu $ Modversion ['hasmain'] = 1; ?> |
Okay. Let's take a look at the aboveCode.
<? PHP // Tutorial Module // Created by kaotik |
The starting point of PHP is described here.
$ Modversion ['name'] = "tutorial "; $ Modversion ['version'] = 1.00; $ Modversion ['description'] = "this is a tutorial module to teach how to build a simple module "; |
The meaning of these three rows is obvious. The name, version, and description of the module.
$ Modversion ['author'] = "kaotik "; $ Modversion ['credits '] = "kaotik "; $ Modversion ['help'] = ""; |
. Author and credits a are also easy to understand. Help (if used, of course, this module does not need to be used) should point to a file, suchLp.htmlOrHelp. php
$ modversion ['license '] =" GPL see license "; $ modversion ['official '] = 0; $ modversion ['image'] =" images/tutorial.png "; $ modversion ['dirname'] =" tutorial "; |
LicenseThis is the license that this module complies with. Remember, GPL indicates your module's number of GPL protocols. Click here to learn more. Official indicates whether this is an official module. In most cases, set it to 0. Image indicates the identifier of this module on the background management page.
// Admin $ Modversion ['hasadmin'] = 0; // Menu $ Modversion ['hasmain'] = 1; ?> |
hasadmin = 0 indicates that this module does not have background management. If you need to display the module in the main menu, set hasmain to 1, otherwise it will not be displayed in the main menu. If both hasadmin and hasmain are set to 0, it will also be displayed in the "module" menu of system management to uninstall this module.