Library config for extensions not working

Locked
User avatar
nicholai
Joomla! Explorer
Joomla! Explorer
Posts: 293
Joined: Sun Jun 11, 2006 10:29 am
Location: Netherlands
Contact:

Library config for extensions not working

Post by nicholai » Wed Oct 25, 2006 7:34 am

Hello

Jinx submitted this code once to me:

Code: Select all

function getConfig()
	{
		jimport('joomla.registry.registry');
		require_once( JPATH_ADMINISTRATOR . '/components/com_pms/config.pms.php' );

		// Create the registry with a default namespace of config which is read only
		$registry = new JRegistry( 'PMSConfig');

		// Create the JConfig object
		$config = new PMSConfig();

		// Load the configuration values into the registry
		$registry->loadObject($config);
	}
But the code isnt working at all.
The config settings are not loaded.
because something like below, doesnt work

Code: Select all

...
$config	=& PMSHelper::getConfig();
....
if ($config->maxmessages)
....
Doesnt give return

And saving the file with the settings doesnt work also

Code: Select all

function settings()
{
	global $mainframe;

	$db		=& JFactory::getDBO();
	$config	=& PMSHelper::getConfig();

	$action = JRequest::getVar('action', NULL, 'GET');

	if ($action == 'save')
	{
		jimport('joomla.registry.registry');
		jimport('joomla.filesystem.file');

		$config->loadArray(JRequest::get( 'POST' ));
		$fname = JPATH_ADMINISTRATOR . '/components/com_pms/config.pms.php';

		if (JFile::write($fname, $config->toString('PHP', 'PMSConfig', array('class' => 'PMSConfig'))))
		{
			$mainframe->redirect( "index.php?option=com_pms&task=settings" , JText::_( 'SETTINGS SAVED' ) );
			exit;
		} else {
			$mainframe->redirect( "index.php?option=com_pms&task=settings" , JText::_( 'SETTINGS NOT SAVED' ));
			exit;
		}
	}

	pmsHtml::settings();
}
Error:
Fatal error: Call to a member function loadArray() on a non-object in C:\Program Files\wamp\www\administrator\components\com_pms\admin.pms.php on line 50
I hope this can be fixed soon, because than i can release my rc1
Last edited by nicholai on Thu Oct 26, 2006 1:07 pm, edited 1 time in total.
Founder and Lead developer of JAM (http://joomladev.org)
JAM is the first J!1.5 only component using AJAX!

Locked

Return to “Third Party Testing for Joomla! 1.5”