Skip to content

Joomla Developer Reference & Cheatsheet

DodaTech Updated Jun 6, 2026 3 min read

Learning Path

    flowchart LR
    A["Joomla Overview"] --> B["Core Concepts"]
    B --> C["Intermediate Topics"]
    C --> D["Advanced Topics"]
    D --> E["Practical Applications"]
    A --> F["You Are Here"]
    style F fill:#f90,color:#fff
  

This reference page is your quick-lookup guide for Joomla development. Every snippet is tested and production-ready.

What You’ll Find

  • MVC directory structure for extensions
  • Database queries using JDatabase
  • Language string system
  • Template override patterns
  • Extension manifest files (XML)
  • Common API references

Module Directory Structure

mod_example/
├── mod_example.xml          # Manifest file
├── helper.php               # Helper class
├── index.html               # Empty security file
├── tmpl/
│   ├── default.php          # Default layout
│   └── index.html
└── language/
    └── en-GB/
        ├── en-GB.mod_example.ini
        └── index.html

Database Queries

<?php
use Joomla\CMS\Factory;

$db = Factory::getDbo();
$query = $db->getQuery(true);

// SELECT with conditions
$query->select($db->quoteName(['id', 'title', 'created']))
      ->from($db->quoteName('#__content'))
      ->where($db->quoteName('state') . ' = 1')
      ->where($db->quoteName('catid') . ' = ' . $db->quote(5))
      ->order($db->quoteName('ordering') . ' ASC')
      ->setLimit(10);

$db->setQuery($query);
$results = $db->loadObjectList();

// INSERT
$object = (object) [
    'title' => 'New Article',
    'alias' => 'new-article',
    'state' => 1,
];
$db->insertObject('#__content', $object);

// UPDATE
$db->setQuery(
    $db->getQuery(true)
        ->update($db->quoteName('#__content'))
        ->set($db->quoteName('title') . ' = ' . $db->quote('Updated Title'))
        ->where($db->quoteName('id') . ' = 1')
);
$db->execute();
?>

Common Query Methods

MethodDescription
loadObjectList()Returns array of objects
loadObject()Returns single object
loadResult()Returns single value
loadAssocList()Returns array of associative arrays
loadColumn()Returns single column as array

Language Strings

<?php
// In PHP files
echo JText::_('MOD_EXAMPLE_GREETING');
echo JText::sprintf('MOD_EXAMPLE_WELCOME', $username);

// In XML manifest
<languages>
    <language tag="en-GB">language/en-GB/en-GB.mod_example.ini</language>
</languages>
?>
; language/en-GB/en-GB.mod_example.ini
MOD_EXAMPLE_GREETING="Hello, World!"
MOD_EXAMPLE_WELCOME="Welcome, %s!"

Template Override Patterns

<?php
// templates/cassiopeia/html/com_content/article/default.php
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;

$app = Factory::getApplication();
$item = $this->item;
$params = $item->params;
?>
<div class="custom-article item-page<?php echo $this->pageclass_sfx; ?>">
  <?php if ($params->get('show_page_heading')) : ?>
    <div class="page-header">
      <h1><?php echo $this->escape($params->get('page_heading')); ?></h1>
    </div>
  <?php endif; ?>

  <article>
    <header class="article-header">
      <h2><?php echo $this->escape($item->title); ?></h2>
      <dl class="article-info text-muted">
        <dt class="article-info-term"><?php echo Text::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>
        <dd class="createdby"><?php echo $item->author; ?></dd>
        <dd class="published">
          <time datetime="<?php echo HTMLHelper::_('date', $item->publish_up, 'c'); ?>">
            <?php echo HTMLHelper::_('date', $item->publish_up, Text::_('DATE_FORMAT_LC3')); ?>
          </time>
        </dd>
      </dl>
    </header>

    <?php if ($item->images->image_intro) : ?>
      <figure class="article-image">
        <img src="<?php echo htmlspecialchars($item->images->image_intro); ?>"
             alt="<?php echo htmlspecialchars($item->images->image_intro_alt); ?>">
      </figure>
    <?php endif; ?>

    <div class="article-body">
      <?php echo $item->text; ?>
    </div>
  </article>
</div>
?>

Common API References

<?php
// JFactory
$app   = Factory::getApplication();       // Application object
$db    = Factory::getDbo();               // Database object
$user  = Factory::getUser();              // Current user
$doc   = Factory::getDocument();          // Document object
$lang  = Factory::getLanguage();          // Language object
$session = Factory::getSession();         // Session object

// JText (Language)
Text::_('COM_CONTENT_ARTICLE');           // Translate string
Text::sprintf('WELCOME_USER', $name);     // Translate with placeholder

// JRoute
Route::_('index.php?option=com_content&view=article&id=1');  // Generate SEF URL

// JHtml
HTMLHelper::_('date', $date, 'Y-m-d');    // Format date
HTMLHelper::_('image', 'path/to/img.jpg', 'alt text');  // Image with lazy loading
?>

Manifest File Template

<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" version="4.0" client="site" method="upgrade">
    <name>mod_example</name>
    <version>1.0.0</version>
    <description>MOD_EXAMPLE_DESCRIPTION</description>
    <author>Your Name</author>
    <copyright>Copyright 2026</copyright>
    <license>GPL v2 or later</license>

    <files>
        <filename plugin="mod_example">mod_example.php</filename>
        <filename>index.html</filename>
        <filename>helper.php</filename>
        <folder>tmpl</folder>
    </files>

    <languages>
        <language tag="en-GB">language/en-GB/en-GB.mod_example.ini</language>
    </languages>

    <config>
        <fields name="params">
            <fieldset name="basic">
                <field name="count" type="number"
                    default="5"
                    label="MOD_EXAMPLE_COUNT_LABEL"
                    description="MOD_EXAMPLE_COUNT_DESC"/>
            </fieldset>
        </fields>
    </config>
</extension>

Common Mistakes

  1. Assuming all features work identically — always check browser/version compatibility.
  2. Skipping documentation — reference docs exist for a reason; consult them.
  3. Not testing edge cases — your setup may differ from tutorials.
  4. Overlooking security — always validate inputs and follow best practices.
  5. Copy-pasting without understanding — type code yourself to build real knowledge.

What’s Next

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro