function __construct($url) { //Parse folder structure $views = new View("", "app/pages/home.php", ""); $views->children = $this->getChildrens("app/pages"); //If requested page is homepage, replace url if (count($url) == 0) { $url = ["home"]; } //Find requested page in folder structure $view = $views->find($url); if ($view == false) { header('HTTP/1.0 404 Not Found'); $view = new View("", "app/pages/404.php", $url); $view->initialize(); } $view->render(); }