Settings registry

From PHPDevShell

Jump to: navigation, search

PHPDevShell offers the developers a way of adding and calling settings from the database quite easily. The settings stored by either the plugin developed or a gui script saving settings to the database. Please see the Writing a plugin documentation on installing settings by default.

The developer can then call the settings he wrote, say I have created two settings values that installed through the plugin system; myName = Jason, and mySurname = King.

These settings happily sits inside the registry database until called upon, so lets call them;

// Get setting values.
$settings = $db->get_settings(array( 'myName', 'mySurname'));
 
// Lets print the values;
print $settings['myName']; // Will print "Jason".
print $settings['mySurname']; // Will print "King".

So I guess that is easy enough, to write setting to the database through a script one could simply:

// Write setting values.
$db->write_settings(array( 'myName'=>'Jason', 'mySurname'=>'King'));

The settings is very useful for plugins that will have default settings.