Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

Core concepts

Before writing code it helps to understand which parts Joomla builds a page from. These words appear in the control panel and in every lesson that follows.

Articles and categories

An article is a page with text: a news item, a blog post, an "About us" page. Every article belongs to a category, and categories can be nested.

Create an article to experiment with: Content → Articles → New, title "First article", any text, then Save & Close. Articles are stored in the #__content table, categories in #__categories.

An article is not visible on the site by itself: it needs a menu item. A menu item in Joomla is not just a link, it states which page of which component to show.

Open Menus → Main Menu → New, in the Menu Item Type field choose Articles → Single Article and pick your article. After saving, a link appears in the site menu and the page gets a readable address.

Component

A component is an extension that renders the main content of a page. Exactly one component works on a page. Which one is visible from the address:

index.php?option=com_content&view=article&id=1
ParameterMeaning
optionThe component: com_content is articles
viewWhich page of the component: article is a single article
idA page parameter: the article number

Open this address on your site — the article with id 1 appears.

Template and positions

A template is the look of the site: the overall markup, header, footer, styles. The default site template is called Cassiopeia. The template markup has one place for the component output and several named places for modules — positions: sidebar-right, banner, footer and others.

Module

A module is a small block around the main content: a menu, a login form, a list of the latest articles. The administrator creates a module in Content → Site Modules, picks a template position for it and the pages it is shown on.

Plugin

A plugin outputs nothing by itself. It is code that runs on an event: an article is being prepared for output, a user logged in, a record was saved. Plugins are enabled in System → Plugins.

How a page is put together

Request /about
   │
   ├─ menu item → component com_content, view=article, id=1
   ├─ Cassiopeia template → the overall markup
   │     ├─ component place ← the article
   │     └─ positions ← modules (menu, sidebar…)
   └─ plugins react to events along the way

What to choose for your task

TaskExtension
Your own page with your own dataComponent
A block in the sidebar or footerModule
Change the behaviour of Joomla or of someone else's extensionPlugin
Change how the site looksTemplate

Common mistake

Beginners create an article and look for it on the site, but it is nowhere to be found. An article appears on the site only through a menu item: either a direct item for that article, or a Category Blog or Category List item that shows all articles of a category.

Thanks for reading!

Donate to the site — we work hard for you.