Saturday, February 11, 2012

[Joomla] Hello World Component ver 1

Whenever a developer want to learn a new language or framework, it always starts on creating on what we call "Hello World" application or program. So in this post (and on the next ones), I'll teach you on how to create a "Hello World" in Joomla component. This will also let you have an overview of how the MVC structure works in Joomla.

I won't explain every code in this post because this post will be about the codes. Maybe in other post, I will.

First, create a folder and name it to com_jchelloworld

Second, we need to create the xml file then name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>
For more info about the xml file, click here

Third, we need to create a php file then name it jchelloworld.php.
  defined('_JEXEC') or die('Restricted access');
  echo "hello world!";

Now that we created the two files, compress the folder into zip file. Make sure that it's a zip file, not a rar file, because Joomla only accepts zip file. Install the component into your Joomla site.

In this tutorial, I have my Joomla site in my localhost and was inside a Joomla15 folder. Since this tutorial is for beginners, I assume you're working in your localhost. So open your browser and type http://localhost/joomla15/index.php?option=com_jchelloworld

You should see something like this

Download version 1 here

version 1
version 2
version 3
version 4
version 5

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...