How to get component parameters?

前端 未结 8 1672
萌比男神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:26

    Helper Function to get Params Object in all Joomla Versions 1.5 / 2.5 /3.x

    class myCompoHelper{
    
        public static function getParams($option)
        {
    
            if (version_compare(JVERSION, '1.5', 'g'))
            {
                $application = JFactory::getApplication();
                if ($application->isSite())
                {
                    $params = $application->getParams($option);
                }
                else
                {
                    jimport('joomla.application.component.helper');
                    $params = JComponentHelper::getParams($option);
                }
            }
            else
            {
                jimport('joomla.application.component.helper');
                $params = JComponentHelper::getParams($option);
            }
            return $params;
        }
    
    }
    
    $params=myCompoHelper::getParams('com_mycomponent');
    echo $params->get('myParamName',null);
    

提交回复
热议问题