PHP Classes

File: autoload.php

Recommend this page to a friend!
  Classes of Martin Lebert   Quickload   autoload.php   Download  
File: autoload.php
Role: Auxiliary script
Content type: text/plain
Description: File invoking Quickload
Class: Quickload
Load classes from multiple directories
Author: By
Last change: changed description
Date: 16 years ago
Size: 977 bytes
 

Contents

Class file image Download
<?php

// directory of this file
define('AUTOLOAD_PHP', dirname(__FILE__) . '/');

require_once(
AUTOLOAD_PHP . 'classes/Quickload.class.php');

/*
 * all paths for Autoload::includePath and Autoload::excludePath must be absolute paths
 * use AUTOLOAD_PHP and a relative path to get an absolute path
 */


// define the paths in which classes can be found
Quickload::$includePath = array( AUTOLOAD_PHP .'example/classes',
                              
AUTOLOAD_PHP .'example/classes2'
                              
);

// define the paths which should not be searched for classes
Quickload::$excludePath = array( AUTOLOAD_PHP .'example/classes/tmp',
                              
AUTOLOAD_PHP .'example/classes2/tmp'
                              
);


function
__autoload($class_name)
{
   
// get the path for the specified class
   
$path = Quickload::getPath($class_name);
   
   
// include the class file
   
require_once($path);
}

?>