Commit 5c290c5f authored by Tondon César's avatar Tondon César
Browse files

partie 4

parent 2b5361cb
......@@ -25,6 +25,10 @@ $app->get('/api/games/',function() {
IndexController::partie2();
})->name('partie2');
$app->get('/partie4',function(){
IndexController::partie4($id);
})->name('partie4');
$app->run();
......
......@@ -44,4 +44,11 @@ class IndexController
$cq2->render();
}
public static function partie4($id){
$game = Game::find($id);
$vue = new VuePartie4($game);
$vue->render();
}
}
\ No newline at end of file
......@@ -12,21 +12,21 @@ class VuePartie1
$json = json_encode($game);
$this->content = <<< END
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" content="application/json">
<link rel="stylesheet" href="css/main.css">
<title>photobox</title>
</head>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" content="application/json">
<link rel="stylesheet" href="css/main.css">
<title>photobox</title>
</head>
<body>
<body>
$json
$json
</body>
</body>
END;
......
<?php
namespace seance\view;
class VuePartie4
{
private $content;
public function __construct($game)
{
$game->description = "...";
$json = json_encode($game);
$json = $json . '"links" : {
"self" : { "href" : "/api/games/'.$game->id.'"}';
$this->content = <<< END
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" content="application/json">
<link rel="stylesheet" href="css/main.css">
<title>photobox</title>
</head>
<body>
$json
</body>
END;
}
public function render()
{
echo $this->content;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment