Welcome to 3DMICK
info@3dmick.com
+91 (971) 119-1127

Create Component in Joomla

Create Component in Joomla

Joomla is a free open source content management system. Joomla is written in PHP,stores data in MySQL database. So, you want to learn how to create your own component in Joomla. A component consists at least of one file, in our case test.php. This file has to reside in the folder /components/com_test. When a component is called, Joomla! looks for a folder with the name of the component, removes the ‘com_’ and looks for a PHP-file with that name. So if you called your component ‘Content’, your folder would have the name ‘com_content’ and the file that Joomla! Would load, would be ‘content.php’.
From this file, you can link to other files. Joomla! provides a special way to do this.
In Joomla Components are the most essential. Components are essentially what you see in the “main” portion of the page. Joomla loads and runs exactly one Component for each page generated.

User View:
1) Create a folder ‘com_test’ in ‘Joomla_installation_directory\components’.
where Joomla_installation_directory is the directory where Joomla is installed inside htdocs.

2) Create a file ‘test.php’ in ‘Joomla_installation_directory\components\com_test\’ containing
Test user

3) You can test this by adding ‘http://localhost/index.php?option=com_test’ in your browser

Admin View:
1) Create a folder ‘com_test’ in ‘Joomla_installation_directory\administrator\components\’.
where Joomla_installation_directory is the directory where Joomla is installed inside htdocs.
2) Create a file ‘helloworld.php’ in ‘Joomla_installation_directory\components\com_test\’ containing
Test Admin
3) You can test this by adding ‘http://localhost/administrator/index.php?option=com_test’ in your browser,

Packaging and Installation
For packaging and installation using ZIP file, prepare the following files and directory outside Joomla Installation directory in com_test folder.
test.xml (Installation File)
site\test.php
site\index.html
admin\test.php
admin\index.html

1) test.xml will contain the following code:

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

Test

2013-02-08
ABC
abc.abc
http://www.abc.com
Copyright Info

License Info
1.01

Test Component ...

index.html
test.php

com_test

index.html
test.php

2) site/test.php will contain following :
Test
3) admin/test.php will contain following :
Test Admin
4) index.html common to all will contain the following :

5) Delete above created directories and files ‘com_test’
6) Prepare the Zip file test.zip,with files and folders mentioned above.
7) Install the ZIP file using extension manager in Joomla 2.5.
8.) SubMenu ‘comtest’ will be built in the ‘components’ menu.
9) You can test this by adding ‘http://localhost/index.php?option=com_test’ in your browser
10) You can test administrator by adding ‘http://localhost/administrator/index.php?option=com_test’ in your browser or by clicking submenu ‘comtest’ in ‘components’ menu,you will get the page