Пример #1
0
/**
 * Auto Load Function
 *
 * This function is able to Auto Load the necessary
 * classes that are inside the library folder.
 *
 * @param string $className The name of the unknown class.
 */
function autoLoad($className)
{
    $file = Dir::preparePath(ROOT . $className . '.php');
    if (file_exists($file)) {
        require $file;
    }
}
Пример #2
0
 /**
  * Constructor
  *
  * The constructor of this class automatically initializes
  * the View and sets the corresponding model path. If the
  * model file exists, it calls it.
  *
  * @param string $name The name of the current Controller.
  */
 public function __construct($name)
 {
     $this->view = new View();
     $path = Dir::preparePath(ROOT . 'models/' . $name . '.php');
     if (file_exists($path)) {
         require $path;
         $modelName = "\\Model\\" . $name;
         $this->model = new $modelName();
     }
 }