From e2c791070c5330916f63fb55c2b639a71a327bcb Mon Sep 17 00:00:00 2001 From: PaulKelbert <paul.kelbert3@etu.univ-lorraine.fr> Date: Wed, 25 Mar 2020 10:55:55 +0100 Subject: [PATCH] partie 2 --- .../seance/src/controller/IndexController.php | 22 +++---------------- Seance5-6/seance/src/view/VuePartie2.php | 5 ++--- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/Seance5-6/seance/src/controller/IndexController.php b/Seance5-6/seance/src/controller/IndexController.php index 4505ac9..004c916 100644 --- a/Seance5-6/seance/src/controller/IndexController.php +++ b/Seance5-6/seance/src/controller/IndexController.php @@ -20,26 +20,10 @@ class IndexController $game = Game::select('id','name','alias','deck')->where('id','<=','200')->get(); // $game = Game::where('id','=',1)->get(); // $json = json_encode($game,JSON_FORCE_OBJECT); - $json = '{ "games" : [ '; foreach($game as $key => $value) { - $json = $json . json_encode($value) . ','; - /*$json = $json . '{ - "id": ' . $value->id . ', - "name":' . $value->name . ', - "deck":' . $value->deck . ', - }, - ';*/ - if ($value->id == 200) { - $json = $json . json_encode($value);/* - $json = $json . '{ - "id": ' . $value->id . ', - "name":' . $value->name . ', - "deck":' . $value->deck . ', - } - ';*/ - } - } - $json = $json . ']}'; + $value->description = "..."; + } + $json = json_encode($game); $cq2 = new VuePartie2($json); $cq2->render(); } diff --git a/Seance5-6/seance/src/view/VuePartie2.php b/Seance5-6/seance/src/view/VuePartie2.php index a7c83ed..892645f 100644 --- a/Seance5-6/seance/src/view/VuePartie2.php +++ b/Seance5-6/seance/src/view/VuePartie2.php @@ -21,12 +21,11 @@ class VuePartie2 <link rel="stylesheet" href="css/main.css"> - <title>photobox</title> + <title>AppliBD</title> </head> <body> - <h1>Titre</h1> - <p>$json</p> + $json </body> END; -- GitLab