Create your own module for joomla

For creating a module in joomla we need two types of file.

– PHP Scripts for business logic.

– XML File for installing the Module and providing any default or administrative value to business logic codes. Other CSS and image files can also be included but these are optional according to the need.

Easy Steps of creating a module

Step I : Create an XML file which contains the information of joomla as well as,

module which is going to be installed.

Step II : Write your business logic in PHP script which will commit your purpose.

Step III : Put all those files in a folder which should have the same name as defined in XML.

Step IV : Zip the folder with the same name using any zip application.

Now this module is ready to use, you can install it in your joomla application, you can create your module according to your need that can be for Joomla 1.0.x or Joomla 1.5.x

Step I

Things which are to be declared in XML file :

First line of XML:

Second Line of XML :

Type : This should be declared as “Module”.

version : This is the place where you can put the value for which version of Joomla you are going to create a module.

Name of Module 

Version of Module

Date of creation

Name of Author

Put the copyright information here.

Licence text

Here an author can put their Email-ID

If S/He want to put their website address 

Put the description of the module.

Above tags are used to put the information related to module and its author, and these are the sub tag of .

Next tag is :


Folder name / filename.php

filename.php

Next tag is :



Inside this XML tag ( ) you can put number of parameters according to your need.

Now close the tag  with 

Step II :

Start your PHP scripts

Put the first line as :

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

I think the purpose of the above line is very clear from its declaration, however, if you are still not sure then let me mention that the above line will restrict the user from direct access of your module.

If you are creating a module for Joomla 1.5.x then you can use the following line also:

defined('_JEXEC') or die('Direct Access to this location is not allowed.');

How to get the value of parameters setted at backend :

$php_varable = $params->get( 'name_of_parameter_declared_in_XML' );

Now complete the PHP scripts as your requirement.

Step III

Put the files inside the folder and rename it as your module name.

Step IV

Zip the folder using any application.

150 150 Burnignorance | Where Minds Meet And Sparks Fly!