-
ALGLAVE Ivan authoredALGLAVE Ivan authored
RecipeList.php 2.03 KiB
<!DOCTYPE html>
<html>
<head>
<title>Drinkpedia</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/RecipeList.css">
</head>
<body>
<ul>
<?php
include "Donnees.inc.php";
include "scripts/Functions.php";
if ($_GET['ids'] == '') echo '<h1>No recipe found</h1>';
else{
$recipesIds = explode('|', $_GET['ids']);
$count = count($recipesIds);
for($i = 0; $i < $count; $i++)
{
$re = explode(':', $recipesIds[$i]);
echo '<li><div class="container">';
echo '<img class="toggleFavourite" src="images/favourite.png" >';
echo '<div class="listElement" onclick="showRecipe(' . intval($re[0]) . ');">';
$recipe = $Recettes[intval($re[0])];
$image_url = getRecipeImage($recipe['titre']);
$image_url = '' . 'Photos/' . $image_url;
if(file_exists($image_url)) echo '<img class="cocktailImg" src="' . $image_url . '"></img>';
else echo '<img class="cocktailImg" src="images/missing.jfif"></img>';
echo '<h1>' . $recipe['titre'] . '</h1>';
echo '</div>';
echo '</div></li>';
}
}
?>
</ul>
<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]);
}
});
function showRecipe(id)
{
var data = {
event: 'recipeselect',
value: id
};
window.top.postMessage(data, [data.event, data.value]);
}
</script>
</body>
</html>