From 53db217fd2ee8e74895856037b9c98a6acf73159 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 30 Mar 2010 15:58:28 -0300 Subject: Adding config.yaml --- config/config.yaml | 3 +++ index.php | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 config/config.yaml diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..0275926 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,3 @@ +--- +implementation: Malete +database: anu10 diff --git a/index.php b/index.php index 21d4d18..37a8117 100644 --- a/index.php +++ b/index.php @@ -17,12 +17,15 @@ function __autoload($class) { require_once 'classes/' .$class. '.php'; } +// Load configuration. +$config = Spyc::YAMLLoad('config/config.yaml'); + // Load database schema. -$schema = Spyc::YAMLLoad('schemas/anu10.yaml'); +$schema = Spyc::YAMLLoad('schemas/'. $config['database'] .'.yaml'); // Setup database connection. -$db = new MaleteDb($schema); -//$db = new PhpIsisDb($schema); +$implementation = $config['implementation'] .'Db'; +$db = new $implementation($schema); // Test connection. if ($db) { -- cgit v1.2.3