How to get component parameters?

前端 未结 8 1780
萌比男神i
萌比男神i 2020-12-24 11:35

I have a problem here and just cant solve it :-/

I am developing an Joomla component with backend. In the backend I set a parameter, the dashboardId, bu

8条回答
  •  星月不相逢
    2020-12-24 12:27

    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!

提交回复
热议问题