Ocs-server/Gfx4/Editing config files programmatically: Difference between revisions

From KDE Community Wiki
(Created page with "GFX provides a handy class that lets you edit config files programmatically to create easy admin modes and settings managers. All changes are made in ram before being saved t...")
 
(No difference)

Latest revision as of 15:48, 5 May 2016

GFX provides a handy class that lets you edit config files programmatically to create easy admin modes and settings managers.

All changes are made in ram before being saved to disk with the save() method. Remember to call save(), or your changes will be lost at the end of object's life.

<?php
//constructor, $namefile can be empty
$config = new EConfigFile($namefile);
//set $key with $value
$config->set($key, $value);
//get $value associated to $key
$config->get($key);
//delete $key from config file
$config->del($key);
//apply modifications, save
$config->save();
?>