These classes are based on a (slightly) improved set of classes and functions that were originally built on CodeAcademy and that we have found extremely useful. They can serve as a basis for not only UserSpice or for your project as a whole. If you copy and paste this code, please get rid of the space before the opening php tag.

Usage

None, really. The config class basically turns the information in the init file into something we can use throughout the system.  As noted in the code, you can uncomment out that first line and it will print the words "config included" on the screen of your page. This helps you verify that the autoload function is loading your classes as it automatically loads each file with a .php extension in the classes folder.

Config.php

<?php
//echo "config included";

//if you are ever questioning if your classes are being included, uncomment the line above and the words "config included" should show at the top of your page.
class Config {
public static function get($path = null){
if($path){
$config = $GLOBALS['config'];
$path = explode('/', $path);

foreach ($path as $bit) {
if(isset($config[$bit])){
$config = $config[$bit];
}
}

return $config;
}

return false;
}
}