Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

Site folders

To write extensions you need to know where Joomla puts files. The folder structure is the same on every site, so a path from a lesson always matches the path on your machine.

Site root

joomla.test/
├── administrator/      the control panel
├── api/                web services (API)
├── cache/              cache
├── cli/                the joomla.php console program
├── components/         site components
├── language/           site translations
├── layouts/            shared layouts
├── libraries/          the Joomla core
├── media/              styles, scripts and images of extensions
├── modules/            site modules
├── plugins/            plugins, sorted into groups
├── templates/          site templates
├── tmp/                temporary files
├── configuration.php   site settings
└── index.php           the site entry point

Every visitor request arrives at index.php. It starts Joomla, and Joomla decides which component renders the page.

Site and administrator

Joomla has two applications: the site (site) and the control panel (administrator). The panel has its own entry point and its own folders with the same names:

administrator/
├── components/     panel components
├── language/       panel translations
├── modules/        panel modules
├── templates/      panel templates
└── index.php       the panel entry point

That is why a component usually has two halves. Articles, for example, are the com_content component:

FolderWhat is in it
components/com_contentPages for visitors: an article, a category list
administrator/components/com_contentPanel screens: the article list, the edit form

The word "client" in the documentation and in XML files means exactly this: client="site" or client="administrator".

Where to look

What you needFolder
The site module mod_hellomodules/mod_hello
The plugin hello of the content groupplugins/content/hello
The Cassiopeia templatetemplates/cassiopeia
Styles and scripts of a modulemedia/mod_hello
Core classeslibraries/src

The libraries/src folder is useful as a reference: the class Joomla\CMS\Language\Text is in the file libraries/src/Language/Text.php. Never edit anything there.

The settings file

configuration.php holds the JConfig class with the settings: database details, the site name, debug mode. It is written by the System → Global Configuration form and is rarely edited by hand — for example after moving the site.

Database tables

Table names start with a prefix chosen during installation, for example abc12_content. In code you write #__ instead of the prefix:

SELECT id, title FROM #__content WHERE state = 1;

Joomla replaces #__ with the real prefix. The query returns the ids and titles of published articles.

Common mistake

Never edit core files or other people's extensions: the first update wipes the changes. Your code goes only into your own extensions. The output of someone else's module is changed with a layout override in the template, and behaviour is changed with a plugin; both techniques are covered later in the course.

Thanks for reading!

Donate to the site — we work hard for you.