Login   Register  
PHP Classes
elePHPant
Icontem

File: web-app/lib/SMVC/Autoload.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of davifelipe  >  smart MVC  >  web-app/lib/SMVC/Autoload.php  >  Download  
File: web-app/lib/SMVC/Autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: smart MVC
MVC framework using Smarty to render views
Author: By
Last change:
Date: 3 years ago
Size: 1,120 bytes
 

Contents

Class file image Download
<?php

/**
 * automatically load classes
 * @version 1.0
 * @author Davi Felipe <davifelipems@hotmail.com>
 */

include_once 'Start.php';

function 
__autoload($class_name) {

     
    
$dir SMVC_Start::getPath();

    foreach (
$dir as $key => $value) {

        
$value $value.'/';
        
$value str_replace('//''/'$value);

        
$path str_replace('_''/'$class_name);

        
        if(
file_exists($value.$class_name.'.php')){
           
            include_once 
$value.$class_name.'.php';
            
$loaded=1;
            continue;
            
       
        }else if(
file_exists($value.'/'.$class_name.'.class.php')){
            
            include_once 
$value.'/'.$class_name.'.class.php';
           
            
$loaded=1;
            continue;

        }else if(
file_exists($value.$path.'.php')){
            
                include_once 
$value.$path.'.php';
                
                
$loaded=1;
                continue;

        }
        
    }
          
        
    if(!
$loaded){

        
SMVC_Start::throwException(SMVC_Locale::getContent(12).$class_name);

    }
}

?>