Skip to main content Link Search Menu Expand Document (external link)

Joomla Specific Standards

  1. Joomla 3.8+ class references
  2. Localized Language Files
  3. Database Class Chaining

Joomla 3.8+ class references

We support Joomla only as far back as Joomla! v3.9.x. This means we want to revise any old class references to the namespaced class structure that was implemented in v3.8.x. For example, this obsolete reference:

$db = JFactory::getDbo();

Would be changed with a use statement at the top and using that reference:

use Joomla\CMS\Factory;

        ...

$db = Factory::getDbo();

You can find a list of the changed classnames here libraries/classmap

Localized Language Files

Translation files should not be implemented using the <language> tag. We keep all language files localized into the extension itself. There should be a properly structured language folder that is included as a folder in the extension manifest. See the discussion in the Joomla! documentation - Manifest Language Files

Database Class Chaining

When creating and using database queries, use the chaining features as follows:

$db = Factory::getDbo();

$query = $db->getQuery(true)
    ->select('od.id, od.name, od.cate_id')
    ->from('#__osdownloads_documents as od')
    ->where('od.published = 1')
    ->order('od.id DESC');

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

Table of contents


Copyright © 2020-2022 Joomlashack. License GPL