PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of David Wainwright   ezphpconfig   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ezphpconfig
Converts xml config file into a set of php classes
Author: By
Last change: Changed line ending to <br />
Date: 15 years ago
Size: 1,275 bytes
 

Contents

Class file image Download
<?php

require_once("ConfigurationLoader.class.php");

ConfigurationLoader::update(null, null);

require_once(
"config.xml.php");

$config = new config();

$lineEnd = "<br />";

echo
"rootDirectory=" . $config->rootDirectory . $lineEnd;
echo
"DATABASE" . $lineEnd;
echo
"Primary connection" . $lineEnd;

$primaryDb = $config->database->primary;
echo
"host=" . $primaryDb->host . $lineEnd;
echo
"username=" . $primaryDb->username . $lineEnd;
echo
"password=" . $primaryDb->password . $lineEnd;
echo
"timeout=" . $primaryDb->timeout . $lineEnd;
echo
"portNo=" . $primaryDb->portNo . $lineEnd;

echo
"Secondary connection" . $lineEnd;
$secondaryDb = $config->database->secondary;
echo
"host=" . $secondaryDb->host . $lineEnd;
echo
"username=" . $secondaryDb->username . $lineEnd;
echo
"password=" . $secondaryDb->password . $lineEnd;
echo
"timeout=" . $secondaryDb->timeout . $lineEnd;
echo
"portNo=" . $secondaryDb->portNo . $lineEnd;

echo
"CARD TYPES" . $lineEnd;

foreach(
array_keys($config->web->cardTypes) as $key)
{
    echo
$key . " = " . $config->web->cardTypes[$key] . $lineEnd;
}

//This will generate a file called newconfig.xml.php that you can look at
ConfigurationLoader::update("example.xml", "newconfig.xml.php");


?>