PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Helper / API Basic

Read Module Parameters Outside the Module

Loads a published module instance by name (and optional title) and parses its Registry parameters.

Updated on 24 November 2026 31 copies 134 views
templates/seu_template/html/layouts/custom/module_config.php
<?php

declare(strict_types=1);

use Joomla\CMS\Helper\ModuleHelper;
use Joomla\Registry\Registry;

$module = ModuleHelper::getModule('mod_banners');
$param  = 'defaultValue';

if ($module && !empty($module->id)) {
    $moduleParams = new Registry($module->params);
    $param        = (string) $moduleParams->get('paramName', 'defaultValue');
}
Uses namespaced ModuleHelper and guards against unpublished modules.
templates/seu_template/html/layouts/custom/module_config.php
<?php
$module       = JModuleHelper::getModule('banners');
$moduleParams = new JRegistry();
$moduleParams->loadString($module->params);
$param        = $moduleParams->get('paramName', 'defaultValue');
Legacy Joomla 3 version using JModuleHelper and JRegistry.

Technical explanation and best practices

When a template or component needs a configuration value stored on a specific module (such as mod_banners), retrieve it via ModuleHelper::getModule().

Pass the module title as the optional second argument when multiple instances of the same module are published.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.