RecipeView.php 1.7 KB
Newer Older
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
1
2
3
4
5
6
7
<!-- HTML Fragment to display a recipe -->
<head>
    <link rel="stylesheet" type="text/css" href="css/RecipeView.css">
</head>

<body>

8
    <img class="toggleFavourite" src="images/favourite.png" >
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
9
    <?php
10
        include "scripts/Functions.php";
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
11
12
13
14
15
16
17
18
        include "Donnees.inc.php";

        $id_recipe = $_GET['id_recipe'];
        $recipe = $Recettes[$id_recipe];

        $r_name = $recipe['titre'];
        $r_ingredients = $recipe['ingredients'];
        $r_recipe = $recipe['preparation'];
19

20
21
22
        $image_url = getRecipeImage($r_name);
        $image_url = '' . 'Photos/' . $image_url;
        if(!file_exists($image_url)) $image_url = 'images/missing.jfif';
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
23
24
25
    ?>

    <div>
26
        <img src=<?php echo "\"" . $image_url . "\"" ?> width="256" height="256"; ?>
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
        <span>
            <h1>
                <?php echo $r_name; ?>
            </h1>
            <h2>Ingrédients :</h2>
            <ul>
                <?php
                    $ingredients = explode('|', $r_ingredients);
                    foreach($ingredients as $ing)
                    {
                        echo '<li>' . $ing . '</li>';
                    }
                ?>
            </ul>
            <h2>Préparation :</h2>
            <p>
                <?php echo $r_recipe ?>
            </p>
        </span>

    </div>

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    <script>
        
        document.addEventListener('keyup', function (e)
            {
                if(e.keyCode == 27)
                {
                    var data = {
                        event: 'keyup',
                        value: e.keyCode
                    };
                    window.top.postMessage(data, [data.event, data.value]);
                }
            });
    </script>

ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
64
</body>