index.php
require('config.php'); use Hajduk\Shortener; $processor = new \Hajduk\Shortener\RequestProcessor(); switch ($_SERVER['HTTP_HOST']) { case ROOT_LANDING_URL: $processor->processLandingRequest($_SERVER['REQUEST_URI']); break; case ROOT_APP_URL: $processor->processAppRequest($_SERVER['REQUEST_URI']); break; case ROOT_SHORT_URL: $processor->processShortRequest($_SERVER['REQUEST_URI']); break; default: break; }
config.php
//Define DB params //Define URL include $filename; } include("RequestProcessor.php");
RequestProcessor.php
namespace Hajduk\Shortener; class RequestProcessor { public function processShortRequest($request) { $shortener = new Shortener(); $shortener->RedirectToDestinationUrl( '/', '', $request ) ); } public function processAppRequest($request) { $dashboard = new Dashboard($request); $dashboard->ProcessRequest(); } public function processLandingRequest($request) { require("landing.view.php"); } }
I wreszcie Dashboard.php który to ma wyświetlić dashboard.view.php ale wygląda na to że mi go nie wyświetla
namespace Hajduk\Shortener; class Dashboard { private $request; private $post; private $get; public function __construct($request) { } public function processRequest() { if (!$this->request) { return; } $this->post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $this->get = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); switch ($this->request) { case "/": $this->showDashboard(); break; } } private function showDashboard() { $clicks = 1020; $count = 100; require("app/views/dashboard.view.php"); } }
Po wpisaniu w przeglądarkę localhost/stronka wyświetla mi się landing page, czyli ok. Jednak po wpisaniu app.localhost/stronka nie wyświetla się nic a wg mojego rozumienia tego kodu powinno się załadować dashboard.view.php
Co robię nie tak? Jaki adres wpisać żeby odpaliła metoda showDashboard() ?
Dzięki.
PS. nospor - cierpliwości
