[DEVELOPPERS]How To use the configuration
Posted: 30 Dec 2010, 18:41
To use the configuration for your plug-in, it's as simple as saying "hello".
First in your plugin you have to define the configurable property as "static public" like this the configuration Loader will be able to override the default value you set. Here is a sample of what your class looks like if there is only this property
To use this property in your plug-in this is how PHP works
Now if you want to change the default value in you configuration file, here is what you have to add to the config.ini file
If the override is correct it should be displayed during the loading of the application.
First in your plugin you have to define the configurable property as "static public" like this the configuration Loader will be able to override the default value you set. Here is a sample of what your class looks like if there is only this property
Code: Select all
namespace ManiaLivePlugin\farfa\MyMegaPluginWhichKillEveryThings
class MyMegaPluginWhichKillEveryThings extends \ManiaLive\PluginHandler\Plugin
{
static property $myConfigurableProperty = 'myDefaultValue';
}
Code: Select all
namespace ManiaLivePlugin\farfa\MyMegaPluginWhichKillEveryThings
class MyMegaPluginWhichKillEveryThings extends \ManiaLive\PluginHandler\Plugin
{
static property $myConfigurableProperty = 'myDefaultValue';
function myCrazyMethod()
{
//This will display in the console the property value;
echo self::$myConfigurableProperty;
}
}
Code: Select all
;This is used to load the plugin
plugins.load[] = 'farfa\MyMegaPluginWhichKillEveryThings'
;This is the override of the default value
plugins.farfa\MyMegaPluginWhichKillEveryThings.myConfigurableProperty = 'myOverridingValue'