<

How To Create a Simple Date Module in JOOMLA

Published on
10,436 Points
4,336 Views
1 Endorsement
Last Modified:
Approved
Welcome Friends,

This is the tutorial for how to create new simple module in joomla 1.5.

In the module has two important files. One is XML file and another file is PHP controller file.

First you need to create the XML file.

<?xml version="1.0" encoding="utf-8"?>
<install type="module" version="1.5.0">
    <!-- Name of the Module -->
        <name>Simple Date - Module</name> 
 
    <!-- Name of the Author -->
        <author>Sathish Kumar(Technicalsathish)</author> 
 
    <!-- Version Date of the Module -->
        <creationDate>2009-12-10</creationDate> 
 
    <!-- Copyright information -->
        <copyright>All rights reserved by Technicalsathish 2009.</copyright> 
 
    <!-- License Information -->
        <license>GPL 2.0</license> 
 
    <!-- Author's email address -->
        <authorEmail>technicalsathish@gmail.com</authorEmail> 
 
    <!-- Author's website -->
        <authorUrl>www.acmewebsoft.com</authorUrl> 
 
    <!-- Module version number -->
        <version>1.0.0</version> 
 
    <!-- Description of what the module does -->
        <description>This is the simple module for displaying current Date</description>
 
    <!-- Listing of all files that should be installed for the module to function -->
        <files>
        <!-- The "module" attribute signifies that this is the main controller file -->
                <filename module="mod_date">mod_date.php</filename>
                <filename>index.html</filename>
        </files>
 
    <!-- Optional parameters -->
        <params />
</install>

Open in new window



Save this file as mod_date.xml

This XML file contains the information about the module(Meta-data). In that we can use more parameter in the Optional parameter area. It may be set by Module manager and it can access with in the module.

After creating a XML file we have to create a PHP controller file.


<?php
//don't allow other scripts to grab and execute our file
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<p>
  	<?php
  		$today = date("D-M-Y");
    	PRINT "$today";
	?>
</p>

Open in new window



Save this as mod_date.php

What happens when this module is loaded is that Joomla! includes (via the PHP include directive) the mod_date.php file and stores the output into an output buffer which is then rendered onto the page output. This file would simply produce Current date to the final page.

In this file have defined function, this can protect from direct access of this file.

And finally we have to create a one HTML file

<html><body bgcolor="#FFFFFF"></body></html>

Open in new window


Save this as index.html

This HTML file is mainly used to protect directory access.

To package this module for distribution and installation, simply zip the files together using winzip or winrar. And named as mod_date.zip.

Finally our module Simple date module ready for installation. After Installation just Go to module manager and publish the module.  

The Date Module attached with this. You can download the module and install.
 mod-date.zip
1
Comment
Author:techsathish
1 Comment
 
LVL 5

Expert Comment

by:manomani
Nice Article to the powerfull joomla Newbie .....

Thanks a lot.....
0

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Join & Write a Comment

Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month