As a webmaster you may need modules that aren't available on the site in this case usually a good webmaster builds it's own :) so if that's the case please consider sharing your module with others as it may make their life easier as this system hopefully does for you.
To submit a third party module just send your module package using the form below and once reviewed it will be posted on the site asap.
Rules for Creating Modules
A few tips for developers when creating a new module. Please note that your module should have only one file - it's easier to install them, and all modules have to be class-es.
-
First important thing is the header that should contain the details of a module added as comments to your php file. For e.g.:
/***************************************************************************
*
* Name: Example Module
* URI: http://jcore.net
* Description: This is an example module to start your own module with.
* Author: Istvan Petres
* Version: 1.0
* Tags: example module, gpl
*
****************************************************************************/
-
Second important thing when you create a module is to register/add it to the modules list, this is done by using:
modules::register('ExampleModule', 'Example Module', 'This is an example module');
ModuleID = an unique id without space only containing characters from A-Z
Module Title = can contain spaces and other non-alphabetic characters but please note that this text will appear below the icons, so it's good to keep it to two max 2 words, the rest won't be seen unless you modify the admin.css
Module Description = just like Module Title but can be longer and will appear on mouse hover and other places where it can be shown.
After module is added/registered it is time to create your class. There are a few rules that you should know about modules as following:
__construct() & __destruct() functions should always be defined and here you should always load your own language files and on destruct reload the original language file. For e.g.:
function __construct() {
languages::load('examplemodule');
}
function __destruct() {
languages::unload('examplemodule');
}
Here the construct loads the "examplemodule.mo" file from the selected language directory (for e.g. en_US) while the destruct loads back the original language file that is used for the whole site (messages.mo).
-
Third important thing is to have an installSQL() and installFiles() functions which both get called if the module is loaded for the first time. These function install all the neccesary files/tables that are needed for the module to function.
-
Forth important thing is to have a display() function declared which will display the content of your module. There is an optional function here, if you want to allow content codes, just check for $this->arguments and use a function called displayArguments() to get the results back. For a full example please see the attached file below.
- Fifth, the admin part you have to define two functions, one is displayAdmin() while the other is verifyAdmin(); Here you can define your own admin system for your module, please see the attached file for a full example.
If you use forms for your module please consider using the form.class.php, that way you should be able to create new forms easily and your module will be css/js compatible with the rest of the modules.
As usually the best way to understand something is to look at examples so I have attached an empty module below that should have all the minimum requirements to build a module as it was thought to be.
* When submitting a new module you agree to receive email notifications from comments posted to your module but your email address will never be shared with anyone. You can opt out of these email notifications by checking "Disable Notification Emails" in you account page but please note, this will deactivate all notification emails except new password requests.
Comments (4)
i have lot of question which could be solved by developement documentation only.plz do it asap.
There is a small glitch in this example module.
When the module is installed and you run it for a test, you'll notice that you can't edit or delete posts created with this module.
It won't create an error or warning, so it will take some time to find it...
BUT the fix is within grasp!
http://forum.jcore.net/viewtopic.php?f=5&t=480&p=2345
What this says, in a brief way, is you should look for {language} and replace it with {examplemodule} before you start building youre own module from this example.
This will be fixed in the 1.0 version