예제 #1
0
 /**
  * Find and include specific controller based on controller name
  *
  * @access public
  * @param string $controller_name
  * @return boolean
  * @throws FileDnxError if controller file does not exists
  */
 static function useController($controller_name)
 {
     trace(__FILE__, "useController({$controller_name})");
     $controller_class = Env::getControllerClass($controller_name);
     if (class_exists($controller_class, false)) {
         return true;
     }
     // if
     $controller_file = Env::getControllerPath($controller_name);
     if (is_file($controller_file)) {
         trace(__FILE__, "useController({$controller_name}) - include_once {$controller_file}");
         include_once $controller_file;
         return true;
     } else {
         throw new FileDnxError($controller_file, "Controller '{$controller_name}' does not exists (expected location '{$controller_file}')");
     }
     // if
 }