PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Template
Basic
Access Parameters of a Menu Item by ID
Loads a specific menu item by request Itemid or known numeric ID and reads its Registry parameters.
templates/seu_template/index.php
<?php
declare(strict_types=1);
use Joomla\CMS\Factory;
$app = Factory::getApplication();
$itemId = $app->getInput()->getInt('Itemid', 0);
$menuItem = $itemId > 0 ? $app->getMenu()->getItem($itemId) : null;
$yourParameter = $menuItem ? $menuItem->getParams()->get('yourParameter', '') : '';
Uses $app->getInput()->getInt('Itemid') and $menuItem->getParams() for Joomla 5 and 6.
templates/seu_template/index.php
<?php
$app = JFactory::getApplication();
$input = $app->input;
$itemId = $input->get->get('Itemid', 0, 'INT');
$menuItem = $app->getMenu()->getItem($itemId);
$params = $menuItem->params;
$yourParameter = $params->get('yourParameter');
Legacy Joomla 3 syntax using $app->input and $menuItem->params.
Technical explanation and best practices
Useful when a module or plugin needs settings from a target menu item (such as a landing page or listing view) via $app->getMenu()->getItem($itemId).