| 
<?php
 function __autoload($class) {
 // The autoload function, a bit messy if you ask me
 $base = strtolower("../{$class}.php");
 $component = strtolower("../components/{$class}.php");
 $container = strtolower("../containers/{$class}.php");
 $document = strtolower("../documents/{$class}.php");
 $element = strtolower("../elements/{$class}.php");
 $helper = strtolower("../helpers/{$class}.php");
 $renderer = strtolower("../renderers/{$class}.php");
 
 if(file_exists($base)) include($base);
 elseif(file_exists($component)) include($component);
 elseif(file_exists($container)) include($container);
 elseif(file_exists($document)) include($document);
 elseif(file_exists($element)) include($element);
 elseif(file_exists($helper)) include($helper);
 elseif(file_exists($renderer)) include($renderer);
 else throw new Exception("Fatal Error: Class {$class} either does not exist!");
 }
 
 ?>
 |