<?php
require_once "class.pConfig.php";
// Checks if Module pConfig is loaded
if (defined("MOD_PCONFIG"))
echo "<h1>pConfig Module Loaded</h1>\n";
$config = new pConfig;
// Creating Childs with custom values
$config->add("child1");
$config->add("child2", "value");
$config->add("child3", array(1 => "value1", "item2" => 200));
$config->add("child1/sub-child1");
$config->comment("child1/sub-child1", "Testing comments");
$config->add("child1/sub-child2", 200);
$config->add("child4", "value");
// Testing get
echo $config->get("child2")."<br />";
echo $config->get("child1")."<br />";
// Testing remove
$config->remove("child2");
// Retrieving useful information
echo "Child4 ".(($config->isRoot("child4")) ? "is" : "isn't")." root<br />";
echo "Child2 ".(($config->hasChilds("child2")) ? "has" : "doesn't have")." childs<br />";
echo "Child1 ".(($config->hasValue("child1")) ? "has" : "doesn't have")." value<br />";
// Writting configuration into file
$config->write("config_generated.ini.php");
?>
|