function loadController($name) { if (is_file(APPBASE . 'controllers' . DS . $name . EXT)) { include APPBASE . 'controllers' . DS . $name . EXT; $className = iGrape::className($name, 'Controller'); if (class_exists($className)) { $controller = new $className(); $controller->name = $name; return $controller; } } // If we got here, there's an error! iGrape::missingController($name); }