Usage

Usage – Using Gtk2_PHPConfig

Using Gtk2_PHPConfig

Simple Configuration GUI

<?php

require_once("Gtk2/PHPConfig.php");

switch (
$argc) {
    case 
1:
        
$test = new Gtk2_PHPConfig(NULL);
        
Gtk::main();
        break;
    case 
2:
        if (
file_exists($argv[1])) {
            echo 
"\nThe INI File is being parsed... Please be patient...\n";
            
$test = new Gtk2_PHPConfig($argv[1]);
            
Gtk::main();
            break;
        } else {
            echo 
"\nThe file does not exist!\n";
        }
    default:
        echo 
"\nUsage: gtk2_phpconfig [INI File]\n";
        echo 
"Where [INI File] is an optional argument, and the name of the
        file you want to edit."
;
        echo 
"\nIf no arguments are passed, a new INI file is created\n\n";
        exit();
}

?>

This example is actually the gtk2_phpconfig executable found in /usr/bin (for *nix systems) after installation of the Gtk2_PHPConfig package.

The example script accepts a single optional argument, i.e. the location of the ini file to edit. If not provided, a new file will be created.

Gtk2_PHPConfig extends GtkWindow and can be treated as an application by itself. Hence, the methods used internally are of no significance to the end user. However, you may refer to the API documentation if you are interested in customization or just understanding how the package works.