This commit is contained in:
William 2022-01-24 16:54:26 +01:00
parent 213d8e8eea
commit 0c3c6b8ae2
7 changed files with 19 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?php
class Simulator
class Example
{
public Database $database;
@ -8,4 +8,9 @@ class Simulator
{
$this->database = $database;
}
public function returnGivenString(string $string): string
{
return $string;
}
}

View File

@ -1,8 +0,0 @@
<?php
class Index {
public function getUsername(): string
{
return 'William';
}
}

View File

@ -1,2 +1,3 @@
<h1>Eksempel side</h1>
<p>Dette er en eksempel side</p>
<p><?=$message?></p>

View File

@ -1,3 +1,2 @@
<h1>Forside</h1>
<p>Ting fungerer noen ganger.</p>
<p><?=$data?></p>

View File

@ -1,11 +1,19 @@
<?php
$app = require '../app/inc.php';
// Flash a message on the next request
$app->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');

View File

@ -1,8 +1,6 @@
<?php
$app = require '../app/inc.php';
$model = $app->model('Index');
$app->view('template/header', ["title" => "Forside"]);
$app->view('index', ["data" => $model->getUsername()]);
$app->view('index');
$app->view('template/footer');

View File

@ -1,8 +1,6 @@
<?php
$app = require '../app/inc.php';
$model = $app->model('Simulator');
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
if (!isset($_POST['cardnumber']) || empty($_POST['cardnumber']))