Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Create a Component/Module for Joomla

Submitted by on October 15, 2009 – 3:36 amNo Comment

Cannot find the component/module that completely meets your requirements within the standard Joomla extensions? Then create it by yourself! In this article I will tell you a simple way to create a unique Joomla extension.


Create a component

Of course, you should have some programming skills to create a difficult component. But writing of php code is not the point of this article. I would like to focus on how it works in Joomla here.

So, in the root folder of your site, navigate to the components folder and create there a folder named as com_myscript (com_ is compulsory prefix and myscript – name of your component). Then create myscript.php file and put it into that folder. When done, you’ll have the .php file with the following path:

../components/com_myscript/myscript.php

Open the file and insert a simple php code there. For example,

<?php
# my script
echo "Hello World!";
?>

Save myscript.php. Your component is ready!

Create a module

Process of creating a new module is similar to creating of the component.

Create mod_ myscript folder within the ../modules/ in the root of your site and put mod_myscript.php file there. As usual, mod_ is compulsory prefix, and myscript is a name of new module. The path to your script should look like:

../modules/mod_myscript/mod_myscript.php

Insert php code into the file and save it.

Then create mod_myscript.xml file and place it at the same folder:

../modules/mod_myscript/mod_myscript.xml

You can use .xml file for some other module as an example. The necessary content of this file would be like the following:

<?xml version="1.0" encoding="utf-8" ?>

- <install type="module" version="1.5.0">

<name>Login</name>

<author>Joomla! Project</author>

<creationDate>October 2009</creationDate>

<copyright>Copyright (C) 2005 – 2008 Open Source Matters. All rights reserved.</copyright>

<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>

<authorEmail>admin@joomla.org</authorEmail>

<authorUrl>www.joomla.org</authorUrl>

<version>1.5.0</version>

<description>DESCLOGINFORM</description>

- <files>

<filename module="mod_myscript">mod_myscript.php</filename>

</files>

</install>

Save the file and enjoy! Your module is ready.

Run the script

So, you have the required component/module. How you can run the script? Very simple – in the address bar of your browser, add /index.php?option=myscript to the URL of your site. Now the URL looks like:

http://mysiteaddress//index.php?option=myscript

You can run any script from your site in such way.

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.