First, you need to select the namespace associated to the parameters with the setNameSpace()
function:
$core->blog->settings->setNameSpace('example');
Note:
The setNamespace() argument should only contain letters (without accents) or numbers.Allowed characters are [a-zA-Z][a-zA-Z0-9]
Use the put()
function to save a parameter. Its arguments are:
_
)# we set the namespace $core->blog->settings->setNameSpace('example'); # we save the parameter $core->blog->settings->put('example',__('Hello World!'),'string','My label'); # we go back to the default namespace $core->blog->settings->setNameSpace('system');
Saving a float:
$core->blog->settings->put('float',415618155.5181,'float');
Saving an integer:
$core->blog->settings->put('integer',21767426,'integer');
Saving a boolean:
$core->blog->settings->put('bool',true,'boolean');
Saving a string:
$core->blog->settings->put('string',__('Hello World!'),'string');
Warning:
To store a string containing more than one line, you should use thebase64_encode()
function when saving, and the base64_decode()
when reading the parameter. This will prevent line break when editing the parameter with about:config.
A parameter is associated to the $core→blog→settings→parameter name variable, for example :
$string = $core->blog->settings->string;
You have to use the drop()
function :
$core->blog->settings->setNameSpace('example'); $core->blog->settings->drop('example');
Wiki powered by Dokuwiki.