// Load settings from an INI file jimport('joomla.registry.registry'); $registry = new JRegistry; $registry->loadINI('/path/to/settings.ini'); // Retrieve a specific setting $setting = $registry->get('setting_name');
// Load settings from an INI file, setting defaults if they aren't already set jimport('joomla.registry.registry'); $registry = new JRegistry; $defaults = array( 'setting1' => 'default_value', 'setting2' => 'default_value', ); $registry->loadINI('/path/to/settings.ini', $defaults); // Retrieve a specific setting $setting = $registry->get('setting1');
// Load settings from a package library INI file jimport('joomla.registry.registry'); jimport('joomla.application.component.helper'); $registry = new JRegistry; $component = JComponentHelper::getComponent('com_mycomponent'); $registry->loadINI($component->params->get('package_library')); // Retrieve a specific setting $setting = $registry->get('setting_name');In this example, we're using the loadINI method to load settings from an INI file that's part of a "package library" for a Joomla component. We first use the JComponentHelper class to get the component's information, then retrieve the path to the package library INI file from the component's parameters. We pass that path to loadINI and retrieve a setting as before. Based on the use of the JRegistry class and the use of the jimport function to import other classes, it's likely that these examples are part of the Joomla framework or a Joomla-based application.