Login   Register  
PHP Classes
elePHPant
Icontem

File: autoloader.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ordland Euroboros  >  PHP GUI API  >  autoloader.php  >  Download  
File: autoloader.php
Role: Auxiliary script
Content type: text/plain
Description: The Autoload File
Class: PHP GUI API
Render HTML pages composed programmatically
Author: By
Last change: small fix.
Date: 1 year ago
Size: 959 bytes
 

Contents

Class file image Download
<?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!");
}

?>