Publishing System Settings Logout Login Register
Creating a Joomla! Extension - Part 1
TutorialCommentsThe AuthorReport Tutorial
Tutorial Avatar
Rating
Add to Favorites
Posted on December 11th, 2009
2453 views
Joomla

If you are reading this, i will assume you are a PHP programmer, you have done some websites here and there, you also know SQL and usually use MySQL databases when making your websites, you may have tried some PHP Frameworks, like CakePHP or CodeIgniter, and you are interested in learning how to extend Joomla!. If you dont know PHP, this won't be a tutorial for you as i will assume complete knowledge of the language. Knowledge of OOP is not neccesary but very reccomended.

If you want to keep reading, i will introduce myself, my name is Federico Ram�rez, also known as "fedekun", and i'm from Argentina, you can read more about me at my profile, but i really doubt you are interested on who i am, this is about Joomla! so let's get started!

Joomla! is a Content Management System, if you are like me, you never cared about this, it was just a fast way for non-programmers to get their site online, till one day, you were forced to use it, and you discovered the potential of this popular CMS.

As this is a tutorial i wont enter in much details about how i got interested in Joomla!, what is relevant here is that i am, and i will teach you how to extend it.

First of all its important to note that, altought you want to extend Joomla!, there is a website called Joomla Extensions, which has many extensions already developed by random programmers, in most cases you will find what you are looking for there.

Also another very important aspect, is that you must learn and use the full of Joomla! Core, you should know what is capable of, and not install or make plugins for what you can do with Joomla! Core.

If you cant get what you what with Joomla! Core, and dont like what it's on Joomla Extensions, or you want to improve it or change it, or if you can't find exactly what you what, then that is the situation to make a new extension.

If you have decided to make an Extension you will need to know what Components, Modules and Plug-in's are, as it will be way better than directly hacking into Joomla! Core's code. Basically, Joomla! divides it's extensions into Components, Modules and Plug-in's.

Components

Components are basically what you see displayed in the main content of a page, for example, an article.
If you have a template with 3 colums, a menu, a content section, and another menu, the Component is what is displayed in the content section.
Components can appear only once in the whole page.

Modules

Modules can appear multiple times in a page, and are basically what you see on the menus.

Plug-in's

Plug-ins are scripts that are excecuted when an action is triggered. Actions are triggered by components, and are such as onPrepareContent, onAfterDisplayTitle, etc.

Now that you know the basics about Joomla! extensions, let's create one! In this tutorial we will make a Component, which is the hardest, and if you know how to make a Component, Modules and Plugin's wont be a problem.

Components in Joomla! uses the MVC design pattern, MVC stands for Model-View-Controller, which is very popular nowadays, because it allows many people to work on the same project, not necessarily with the same purpose, for example, in a website, you can have some people working on a site template, while others do the coding.

MVC may seems strange and at first, but you will get used to it and who knows, maybe you will like it!

You must know the basics about MVC, here we will make the distinction between Models, views and Controllers, basically, in Models you do all stuff related to getting data, normally from a SQL database. In Views we show that data, and the Component is what put Models and Views together, and is what is called first when a page is loaded.

Models, Views and Controllers in Joomla! are just classes extending Joomla! base Model, View or Controller class, and placed in a certain folder with a certain file name and class name.

At first it will be hard to determine where each piece of code must go, but with practice you will realise easier.

So, let's begin, first of all, i know there are other tutorials on this, but they are all pretty basic, so in this tutorials i will make a little more complicated Component, but i will start from scratch and try to go step for step. In this tutorial i will make a component which will be a very simple forum, in the back-end you will be able to add categories and forums, and customize some forum settings, like, allow anonymous posting, etc, and in the front-end users will be able to add threads to the forums, and reply to those threads, and administrators will be able to edit and delete those threads and replies.

Seems easy yet useful right? I hope so, it was the idea of these tutorials.

Just a note, i will be writing the Component at the same time as the tutorial, taking screenshots and stuff, so i may change something later.

Next Page
Pages: 1 2
Dig this tutorial?
Thank the author by sending him a few P2L credits!

Send
fedekun

My name is Federico Ramirez, and i'm from Argentina.
I study Licenciature in Computer Science at Universidad Nacional del Sur, Bahia Blanca, Argentina.
I began programming when i was 15, also started using photoshop by that age, and making web development
View Full Profile Add as Friend Send PM
Pixel2Life Home Advanced Search Search Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Pixel2life Homepage Submit a Tutorial Publish a Tutorial Join our Forums P2L Marketplace Advertise on P2L P2L Website Hosting Help and FAQ Topsites Link Exchange P2L RSS Feeds P2L Sitemap Contact Us Privacy Statement Legal P2L Facebook Fanpage Follow us on Twitter P2L Studios Portal P2L Website Hosting Back to Top