Skip to content
Snippets Groups Projects
RecipeView.php 1.35 KiB
<!-- 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>

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

</body>