learning joomla! in a weekend (for developers)

39
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

Upload: valentin-despa

Post on 12-Jun-2015

473 views

Category:

Technology


5 download

DESCRIPTION

A few tips and tricks about starting developing in Joomla.

TRANSCRIPT

Page 1: Learning Joomla! in a weekend (for developers)

Learning Joomla! in a weekend

Rules and Tricks for programmersApplies to Joomla! CMS versions 2.5 and 3.x

Document version 1.1.Updated: 28th September 2014

Created by Valentin Despa

Page 2: Learning Joomla! in a weekend (for developers)

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.

Page 3: Learning Joomla! in a weekend (for developers)

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

Page 4: Learning Joomla! in a weekend (for developers)

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!

Page 5: Learning Joomla! in a weekend (for developers)

Let us be realisticI 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.

Page 6: Learning Joomla! in a weekend (for developers)

CONTENTS

1. Introduction in Joomla2. 5 Rules to Keep you on Track3. 5 Tips to Make your Life easier4. Getting started (aka. And now what?)5. Resources (Books, Videos)

Page 7: Learning Joomla! in a weekend (for developers)

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.

Page 8: Learning Joomla! in a weekend (for developers)

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.

Page 9: Learning Joomla! in a weekend (for developers)

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

Page 10: Learning Joomla! in a weekend (for developers)

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.

Page 11: Learning Joomla! in a weekend (for developers)

5

Rules to Keep you on Track

Page 12: Learning Joomla! in a weekend (for developers)

Rule 1

Understanding the architecture your extension needs.

Page 13: Learning Joomla! in a weekend (for developers)

A piece of adviceDon’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.

Page 14: Learning Joomla! in a weekend (for developers)

Joomla! architectureJoomla! 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.

Page 15: Learning Joomla! in a weekend (for developers)

Your extension architectureMost 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).

Page 16: Learning Joomla! in a weekend (for developers)

Rule 2

Setup a proper development environment

Page 17: Learning Joomla! in a weekend (for developers)

Choosing the right IDEPlease 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.

Page 18: Learning Joomla! in a weekend (for developers)

Configuring your debuggerThe 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.

Page 19: Learning Joomla! in a weekend (for developers)

Rule 3

Keep it simple

Page 20: Learning Joomla! in a weekend (for developers)

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.

Page 21: Learning Joomla! in a weekend (for developers)

Rule 4

Look into extensions that have a similar functionality

Page 22: Learning Joomla! in a weekend (for developers)

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.

Page 23: Learning Joomla! in a weekend (for developers)

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.

Page 24: Learning Joomla! in a weekend (for developers)

Rule 5

Knowing what to Search for

Page 25: Learning Joomla! in a weekend (for developers)

How can I build a plugin??? HelpTHIS 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!

Page 26: Learning Joomla! in a weekend (for developers)

5

Tips to Make your Life easier

Page 27: Learning Joomla! in a weekend (for developers)

Tip 1

Using the Component Creator

Page 28: Learning Joomla! in a weekend (for developers)

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.

Page 29: Learning Joomla! in a weekend (for developers)

Tip 2

Ask the experts

Page 30: Learning Joomla! in a weekend (for developers)

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.

Page 31: Learning Joomla! in a weekend (for developers)

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.

Page 32: Learning Joomla! in a weekend (for developers)

Tip 3, 4, 5 ...

Not finished yet :(

Page 33: Learning Joomla! in a weekend (for developers)

And now what?

aka.

Getting started

Page 34: Learning Joomla! in a weekend (for developers)

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.

Page 35: Learning Joomla! in a weekend (for developers)

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.

Page 36: Learning Joomla! in a weekend (for developers)

Resources

Page 37: Learning Joomla! in a weekend (for developers)

Resources: BooksJoomla! 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.

Page 38: Learning Joomla! in a weekend (for developers)

Resources: VideoThis 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)

Page 39: Learning Joomla! in a weekend (for developers)

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