1. Learning Joomla!
in a weekend
Rules and Tricks for
programmers
Applies to Joomla! CMS versions 2.5 and 3.x
Document version 1.1.
Updated: 28th September 2014
Created by Valentin Despa
2. This is for you if ...
- are new to Joomla!.
- need to quickly develop an extension in Joomla
- do not have much time to get started.
- already have a decent experience in PHP.
- you know how to install a web server / database on your
development machine.
- OOP and MVC mean something for you.
3. What this is NOT ...
- a step by step guide on how to create extensions
- a tutorial for installing Joomla
- so relevant if you are building just a template
- a programming tutorial as you will not find a single line of
code inside
- a hand-on guide but more like bla bla about the topic
4. Hello World!
My name is Valentin Despa. I am a PHP developer and I
have been using Joomla starting with version 1.5. Since
2013 I am also member in the Joomla! Bug Squad (JBS).
You can find me on Joomla! StackExchange answering
programming questions or on the issue tracker and github
testing and fixing bugs.
I am writing this because I wanted to share with you my
experience of learning Joomla!
5. Let us be realistic
I totally understand your desire to learn quickly and finish
whatever task you are on right now on time.
Maybe you do not even care very much about learning
Joomla. You just want to get something to work. That is
fine.
Extension development does take some time and
experience, so probably few will learn Joomla from zero in
a weekend and deploy an extension by Monday.
6. CONTENTS
1. Introduction in Joomla
2. 5 Rules to Keep you on Track
3. 5 Tips to Make your Life easier
4. Getting started (aka. And now what?)
5. Resources (Books, Videos)
7. 1. Introduction in Jooma!
A few words about Joomla!
● Joomla! is an open source CMS, created and
maintained by volunteers and many developers use it
as platform for developing extensions, which extend
Joomla! beyond the basic functionality of a CMS.
● In runs in PHP 5.3+ and can use one of the supported
database engines: MySQL / MariaDB, MSSQL and
PostgreSQL.
8. 1. Introduction in Jooma!
Note about Joomla! versions
At the time of this writing, Joomla 3.3 is the latest version. Next
versions which are largely compatible with one another. Always keep
your installation updated!
On the Internet, you will also find documentation for Joomla 2.5 or 1.7
and 1.6. which still can be relevant. If you find any examples /
documentation for Joomla 1.5 it will probably be too outdated, so better
ignore it.
Also Joomla! Framework is a standalone PHP framework, has little to
do with the CMS, so don’t refer to it, as you probably don’t need it.
9. Installing Joomla!
Go to www.joomla.org. If you have no idea what you need,
download Joomla 3, it’s the best for your needs probably.
For the development installation, to see as much as the
features enabled, install the sample data for testing.
Ideally you would want to use two installations of Joomla!
on your development system:
- one to include in your IDE
- one for test-installing your extension
10. What the heck??
While researching, you will find a lot of different ways of developing in
Joomla. Let’s break it down:
- Legacy MVC - This is the current wide adopted method. Don’t let
the word legacy scare you. Most of the core components rely on it.
Also a lot of 3rd party extensions. This is where you should start!
- New MVC - a new design introduced in Joomla but with little
adoption. I would stay away from it, at least now.
- Joomla! Framework - this is a standalone framework like Zend,
Symfony etc. This is NOT what you need in the Joomla CMS.
- FOF (Framework on Framework) is a Rapid Application
Development framework. You may want to look into it later.
13. A piece of advice
Don’t focus on what you need to do, focus on learning
and understanding how things work.
What I mean by this is you shouldn’t start building your extension
yet. Understand how Joomla! and other extensions work first.
You will probably find lots of tutorials explaining how to do
something, but few will explain why you do something like this. The
reality is that you will need to find the answer yourself by
understanding the code that you write.
14. Joomla! architecture
Joomla! in build on top of the Joomla! Platform or informally called
Joomla! API (which later evolved as a standalone PHP framework
under the name Joomla! Framework).
The nice thing about Joomla! is that it uses components, templates,
modules and plugins to display everything that you see. So go ahead
and check the source code of different core extensions and learn from
them.
15. Your extension architecture
Most of the time you will want to build a component as this is a basic
building block which can provide a lot of functionality. This is the case
especially if you are listing items from a database, you want to edit them etc.
However it’s important to understand what you want to do and what extension
type you need. Best is to do a search first, you are not the first one building
something.
Quite often just an extension type is not enough, so you will use a combination
of them. You will notice that some extension providers choose to deliver their
extension as a package (inside it could be components, modules, plugins -
there is actually no restriction).
17. Choosing the right IDE
Please don’t use Notepad++ or something similar for
development. It just does not work. I really mean it!
Good open-source & free solutions are Eclipse Standard
(with PDT) and Netbeans.
Commercial, but absolutely worth the money is PhpStorm.
Read more about Setting up your workstation for Joomla! development.
18. Configuring your debugger
The most important feature you need to have in your IDE up
and running is the Debugger.
In Eclipse / Netbeans it’s a bit tricky to configure, but there are
plenty of tutorials out there. Take your time and do it right.
When something does not work right, go with the debugger
through Joomla!. You will learn a lot.
Don’t skip this part! Do it now! It will get back at you later. I promise.
20. You are NOT the first one!
Even if it seems that what you need to do is sort of the never
done before, it is very unlikely to be like that.
Try to break your project into smaller pieces. Solve one issue
at a time. If you understand your extension, you will be able to
find similar functionality and fill the gaps yourself.
Start small and evolve.
21. Rule 4
Look into extensions that have a similar
functionality
22. Inspecting the Joomla core
There are some basic core components
which are worth inspection: Banners
(com_banners) and , especially the backend
part.
Understand the code, go with the debugger,
modify.
23. Don’t be afraid to look inside
Most of the time you will be extending base
classes to achieve a certain functionality.
Go checkout this classes you extend. There
are all under /libraries/joomla or
/libraries/legacy.
25. How can I build a plugin??? Help
THIS IS IMPORTANT! Actually in Joomla! a plugin (in the
general sense) is generally called “EXTENSION”.
There are many types of extensions, and it IMPORTANT to
understand the distinction between them, especially
when asking questions on user forums or searching for
documentation.
Read more about Extension types in Joomla!
28. Component Creator
The Component Creator for Joomla *, is a
commercial online tool for generating the main files
and structure. It also offers a free tier, which is just
enough to get you started.
It will save you hours of work and get you on the
right track sooner.
* I am not affiliated with this product / company. This is not a referral link or similar.
30. Know how to Ask
There are a lot of online communities out
there eager to answer your questions. But
you need to know how to ask.
31. A few tips
● Invest some time to research. There is a good chance somebody
else had the same issue in the past.
● Make the question as clear as possible. A lot of questions are
too vague and are really hard to answer.
● Make the question making it as short as possible. Nobody
wants to read the whole history of your extension. Strip out
everything that is not relevant.
● Share a minimum code / sample where something is not working.
Don’t throw tons of lines of code that nobody reads.
● If you hear things like This is not a good idea, I would not do it like
that this means: YOU ARE ON A WRONG TRACK.
34. Your first extension!
A starting point is the tutorial Developing a
MVC Component. While not very advanced,
it walks you through the basic things in
Joomla.
More developer resources are available under the
Developer portal.
35. And now what?
Actually there is no path on learning Joomla. Sorry
to disappoint you. Each has different needs and
knowledge.
The only clear path is by experimenting, reading,
coding...
Find a book that has good reviews, follow some
tutorials.
37. Resources: Books
Joomla! Programming Book by Mark Dexter and Louis Landry - written for Joomla 2.5 but still relevant
for Joomla 3, it’s an almost 600 pages book. It focuses on explaining how Joomla works. Highly
recommended but it needs more than a weekend to read.
38. Resources: Video
This is a list of resources I’ve personally tested and found
valuable:
● Learn the Art of Joomla with Andrew Eddie - around two hours of learning material for Joomla
1.6 and 1.7, mostly still relevant today. Worth seeing. (free)
● Joomla! 1.7: Programming and Packaging Extensions with Joseph LeBlanc (commercial)
39. Thanks for reading this!
I wish you a good luck in learning Joomla!
I would love to get some feedback from
you regarding your Joomla learning
experience and this presentation.
Write me on Twitter @vdespa