RecipeView.php 1.35 KB
Newer Older
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
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
<!-- HTML Fragment to display a recipe -->
<head>
    <link rel="stylesheet" type="text/css" href="css/RecipeView.css">
</head>

<body>

    <?php
        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'];
    ?>

    <div>

        <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>

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    <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
58
</body>