Login   Register  
PHP Classes
elePHPant
Icontem

File: hawkphp/hawkphp/loadclass.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of tianfan  >  HawkPHP framework  >  hawkphp/hawkphp/loadclass.php  >  Download  
File: hawkphp/hawkphp/loadclass.php
Role: Auxiliary script
Content type: text/plain
Description: framework core
Class: HawkPHP framework
Framework that implements MVC design pattern
Author: By
Last change: fixed some bug
Date: 2010-02-20 01:58
Size: 702 bytes
 

Contents

Class file image Download
<?php
/*
 * author :&#22825;&#20961;
 * mail:arrbo@163.com
 * homepage:blog.tianfan.net
 */
function __autoload($className){
        
$dir=dirname(__FILE__);
    if(
preg_match('/^[a-z]+Model$/',$className)){
        
$classTag=$dir.'/../model/';
    }
    elseif(
preg_match('/^[a-z]+View$/',$className)){
        
$classTag=$dir.'/../view/';
    }
    else{
        if(
file_exists($dir.'/'.$className.".php"))
            
$classTag=$dir.'/';
        else 
            
$classTag=$dir.'/../lib/';
    }
    
/*debug::echo $file;*/    
    
$file=$classTag.$className.".php";    
    if(!
file_exists($file)){
        return 
false;
    }
    else{
        require_once (
$file);
    }
        unset (
$file);
        unset (
$classTag);
        unset (
$dir);
    return 
true;
}
?>