diff --git a/app/model/Simulator.php b/app/model/Example.php similarity index 55% rename from app/model/Simulator.php rename to app/model/Example.php index 4747fd0..99e1504 100644 --- a/app/model/Simulator.php +++ b/app/model/Example.php @@ -1,6 +1,6 @@ database = $database; } + + public function returnGivenString(string $string): string + { + return $string; + } } \ No newline at end of file diff --git a/app/model/Index.php b/app/model/Index.php deleted file mode 100644 index 0ed1d87..0000000 --- a/app/model/Index.php +++ /dev/null @@ -1,8 +0,0 @@ -Eksempel side -
Dette er en eksempel side
\ No newline at end of file +Dette er en eksempel side
+=$message?>
\ No newline at end of file diff --git a/app/view/index.php b/app/view/index.php index 2cc9fda..6e6ded2 100644 --- a/app/view/index.php +++ b/app/view/index.php @@ -1,3 +1,2 @@Ting fungerer noen ganger.
-=$data?>
\ No newline at end of file +Ting fungerer noen ganger.
\ No newline at end of file diff --git a/public/example.php b/public/example.php index 7200be2..ab8e53c 100644 --- a/public/example.php +++ b/public/example.php @@ -1,11 +1,19 @@ session->flash('Eksempel', 'info'); $app->session->flash('Eksempel', 'success'); $app->session->flash('Eksempel', 'warning'); $app->session->flash('Eksempel', 'danger'); +// Grab model and perform task +$model = $app->model('Example'); +$message = $model->returnGivenString('Hei på deg!!'); + +// Render the view with prepared data $app->view('template/header', ['title' => 'Eksempel side']); -$app->view('example'); +$app->view('example', [ + 'message' => $message +]); $app->view('template/footer'); \ No newline at end of file diff --git a/public/index.php b/public/index.php index 523cec1..28ae62d 100644 --- a/public/index.php +++ b/public/index.php @@ -1,8 +1,6 @@ model('Index'); - $app->view('template/header', ["title" => "Forside"]); -$app->view('index', ["data" => $model->getUsername()]); +$app->view('index'); $app->view('template/footer'); \ No newline at end of file diff --git a/public/simulator.php b/public/simulator.php index 03b0002..c0b058b 100644 --- a/public/simulator.php +++ b/public/simulator.php @@ -1,8 +1,6 @@ model('Simulator'); - if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_POST['cardnumber']) || empty($_POST['cardnumber']))