PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Template Override Basic

Read Active Template Parameters Outside the Template

Fetches the active template object (including params and parent) inside component overrides, modules or plugins.

Updated on 24 November 2026 34 copies 148 views
templates/seu_template/html/com_content/article/default.php
<?php

declare(strict_types=1);

use Joomla\CMS\Factory;

$template = Factory::getApplication()->getTemplate(true);
$param    = (string) $template->params->get('paramName', 'defaultValue');
Also exposes $template->parent for Joomla 5 and 6 native child templates.
templates/seu_template/html/com_content/article/default.php
<?php
$app      = JFactory::getApplication('site');
$template = $app->getTemplate(true);
$param    = $template->params->get('paramName', 'defaultValue');
Legacy Joomla 3 call via JFactory::getApplication('site').

Technical explanation and best practices

Inside component overrides, layouts or modules, $this does not reference the template document. Call Factory::getApplication()->getTemplate(true) to obtain $template->params and $template->parent.

Direct Engineering

Have a Joomla project or technical challenge in mind?

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