Login   Register  
PHP Classes
elePHPant
Icontem

File: Autoload.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of MARY Matthieu  >  Html  >  Autoload.php  >  Download  
File: Autoload.php
Role: Auxiliary script
Content type: text/plain
Description: loader
Class: Html
Generate HTML pages using page element classes
Author: By
Last change:
Date: 2007-06-24 03:37
Size: 964 bytes
 

Contents

Class file image Download
<?php
/**
 * $Id: Autoload.php 1370 2007-04-05 19:46:16Z matthieu $
 */
if (!function_exists('__autoload')) {
    
/**
     * load class
     * @param string $className : the class to load
     * @throws Exception
     */
    
function __autoload($className) {
        if (
class_exists('Zend'false)) {
            if (
is_int(strrpos($className'_Interface'))) {
                
Zend :: loadClass($className);
            } else {
                
Zend :: loadInterface($className);
            }
        } else {
            if (!
defined('__CLASS_PATH__')) {
                
define('__CLASS_PATH__'realpath(dirname(__FILE__)));
            }
            
$file __CLASS_PATH__ '/' str_replace('_''/'$className) . '.php';
            if (!
file_exists($file)) {
                throw new 
Exception('Cannot load class file ' $className);
            } else {
                require_once 
$file;
            }
        }
    }
}