Login   Register  
PHP Classes
elePHPant
Icontem

File: library/library.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Assontia Patient  >  PDO Database class  >  library/library.php  >  Download  
File: library/library.php
Role: Configuration script
Content type: text/plain
Description: Library of functions and globals
Class: PDO Database class
Access SQL databases using PDO
Author: By
Last change:
Date: 2012-06-03 03:56
Size: 682 bytes
 

Contents

Class file image Download
<?php 
// Global Variables
global $class_folder;

$class_folder ".".DIRECTORY_SEPARATOR."classes"// to change if your class folder has a different name
// Autoload classes dynamically

function __autoload($class_name) {
    
    global 
$class_folder;
    
    
$path_to_class $class_folder DIRECTORY_SEPARATOR $class_name '.class.php';
    
    
$file get_path($path_to_class);
    
    if(
is_file($file))
        try {
            include_once 
$file;
        } catch (
Exception $e) {
            throw new 
Exception("Unable to load php class file $file from classes folder");
            die;
        }
    else
        include_once 
get_path('./config.php');
}

function 
get_path($path) {
    return 
realpath($path);
}