Thread: New approach
View Single Post
Old 05-06-2008, 07:06 PM   #14 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

It started producing errors when I removed it from the load() method but it was still in my pages and other classes. So now I gotta go through and remove it from a whole bunch of places... *sigh* most of my work isn't even going forward, it's learning something new and going backwards to revamp all my existing code.

Oh well, that gave me an excuse to optimize my load() method. Here's the new one, should be error free, me thinks?

PHP Code:
static function load ($szModule$szClass$szArgs=null) {

    
$szFilename "{$szModule}.{$szClass}.php";
    
$szClass    "kePhoto_{$szModule}_{$szClass}";

    if (!
array_key_exists($szClassself::$Library)) {

        if (!
class_exists($szClass)) include(PATH_TO_LIB."/{$szFilename}");
        
self::$Library[$szClass] = new $szClass($szArgs);

    }
    
    return 
self::$Library[$szClass];
            

Doesn't look very complicated at all now. Maybe I'll include the old version of it in my sample code snippets that I send to prospective employers so they think it does more.
-m
delayedinsanity is offline  
Reply With Quote