Merge pull request #26 from ThomasRubini/fix_home_view

fixed recipes view and translations
This commit is contained in:
Marla 2023-01-18 14:22:34 +01:00 committed by GitHub
commit 8bd4cd4f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 33 deletions

View File

@ -5,6 +5,26 @@ final class DefaultController
public function defaultAction(Array $A_urlParams = null, Array $A_postParams = null) public function defaultAction(Array $A_urlParams = null, Array $A_postParams = null)
{ {
View::show("home/view"); $array_recipes = array(
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
);
View::show("home/view", $array_recipes);
} }
} }

View File

@ -20,7 +20,7 @@ final class RecipeModel
$A_recipe = self::getRecipeByID($I_id); $A_recipe = self::getRecipeByID($I_id);
if ($A_recipe === null)return null; if ($A_recipe === null)return null;
$A_recipe["IMAGE_URL"] = "/static/img/recettes/".$A_recipe["ID"].".jpg"; $A_recipe["IMAGE_URL"] = "/static/img/recipes/".$A_recipe["ID"].".jpg";
$O_ingredientModel = new IngredientModel(); $O_ingredientModel = new IngredientModel();
$A_recipe["INGREDIENTS"] = $O_ingredientModel->searchByRecipe($A_recipe["ID"]); $A_recipe["INGREDIENTS"] = $O_ingredientModel->searchByRecipe($A_recipe["ID"]);

View File

@ -1,7 +1,7 @@
<a href="/recipe/view/<?= $A_view["id"]?>"> <a href="<?= $A_view["LINK"]?>">
<img src="<?= $A_view["img"] ?>" alt="<?= $A_view["nom"]?>"> <img src="<?= $A_view["IMG"] ?>" alt="<?= $A_view["NAME"]?>">
<section> <section>
<h2> <?= $A_view["nom"]?> </h2> <h2> <?= $A_view["NAME"]?> </h2>
<p> <?= $A_view["note"]?> </p> <p> <?= $A_view["NOTE"]?> </p>
</section> </section>
</a> </a>

View File

@ -1,34 +1,14 @@
<?php
$array_recipes = array(
array(
"nom" => "Quaso",
"img" => "4.jpg",
"note" => "4.5"
),
array(
"nom" => "Quaso",
"img" => "4.jpg",
"note" => "4.5"
),
array(
"nom" => "Quaso",
"img" => "4.jpg",
"note" => "4.5"
),
);
?>
<img src="static/img/bandeau.jpg" alt="Cook"> <img src="static/img/bandeau.jpg" alt="Cook">
<main>
<section> <section>
<h1> idées recettes: </h1> <h1> Nos idées recettes: </h1>
<section>
<?php <?php
foreach ($array_recipes as $recipe){ foreach ($A_view as $recipe){
View::show("common/recipe", $recipe); View::show("common/recipe", $recipe);
} }
?> ?>
</section> </section>
</section> </main>

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB