How to get component parameters? How to get component parameters? php php

How to get component parameters?


There's a more simple way.First import Joomla Component Helper:

jimport('joomla.application.component.helper'); // not required in Joomla 3.x

And then retrieve any attribute you want like this:

$params = JComponentHelper::getParams('com_dashboard');$dashboardID = $params->get('dashboardID');

Greetings.


$app = JFactory::getApplication('site');$componentParams = $app->getParams('com_example');$param = $componentParams->get('paramName', defaultValue);


Similar to the answer provided by LoboX, I'd recommend using the component helper to get component parameters:

jimport('joomla.application.component.helper'); // Import component helper library$params = JComponentHelper::getParams(JRequest::getVar('option')); // Get parameter helper (corrected 'JRquest' spelling)$params->get('parameter_name'); // Get an individual parameter

The JRequest::getVar('option') returns your component's name with the com_ prefix. Aside from that, it looks like you're trying to mix a little bit of 1.5/1.6 syntax into your configuration file. If you haven't seen it yet, try reading through the 2.5 version of the documentation. I hope that helps!