-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrecette.php
53 lines (43 loc) · 1.49 KB
/
recette.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once('templates/header.php');
require_once('lib/tools.php');
require_once('lib/recipe.php');
$id = (int)$_GET['id'];
$recipe = getRecipeById($pdo, $id);
if ($recipe) {
$ingredients = linesToArray($recipe['ingredients']);
$instructions = linesToArray($recipe['instructions']);
?>
<div class="row flex-lg-row-reverse align-items-center g-5 py-5">
<div class="col-10 col-sm-8 col-lg-6">
<img src="<?=getRecipeImage($recipe['image']); ?>" class="d-block mx-lg-auto img-fluid" alt="<?=$recipe['title']; ?>" width="700" height="500" loading="lazy">
</div>
<div class="col-lg-6">
<h1 class="display-5 fw-bold lh-1 mb-3"><?=$recipe['title']; ?></h1>
<p class="lead"><?=$recipe['description']; ?></p>
</div>
</div>
<div class="row flex-lg-row-reverse align-items-center g-5 py-5">
<h2>Ingrédients</h2>
<ul class="list-group">
<?php foreach ($ingredients as $key => $ingredient) { ?>
<li class="list-group-item"><?=$ingredient; ?></li>
<?php } ?>
</ul>
</div>
<div class="row flex-lg-row-reverse align-items-center g-5 py-5">
<h2>Instructions</h2>
<ol class="list-group list-group-numbered">
<?php foreach ($instructions as $key => $instruction) { ?>
<li class="list-group-item"><?=$instruction; ?></li>
<?php } ?>
</ol>
</div>
<?php } else { ?>
<div class="row text-center">
<h1>Recette introuvable</h1>
</div>
<?php } ?>
<?php
require_once('templates/footer.php');
?>