Merge pull request #34 from ThomasRubini/fix_categories

Fix categories
This commit is contained in:
Marla 2023-01-20 10:17:46 +01:00 committed by GitHub
commit 891f694561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 28 deletions

View File

@ -1,31 +1,31 @@
<?php
final class CategoriesController
final class CategoryController
{
public function defaultAction(Array $A_urlParams = null, Array $A_postParams = null)
{
$A_array_recipes_Type_de_cuisson = array( //test
array(
"RECIPE_LINK" => "http://exemple",
"IMG_LINK" => "2.jpg",
"RECIPE_LINK" => "/recipe/view/2",
"IMG_LINK" => "/static/img/recipes/2.jpg",
"NAME" => "Croissant",
"NOTE" => "4.5"
),
array(
"RECIPE_LINK" => "http://exemple",
"IMG_LINK" => "2.jpg",
"RECIPE_LINK" => "/recipe/view/2",
"IMG_LINK" => "/static/img/recipes/2.jpg",
"NAME" => "Croissant",
"NOTE" => "4.5"
),
array(
"RECIPE_LINK" => "http://exemple",
"IMG_LINK" => "2.jpg",
"RECIPE_LINK" => "/recipe/view/2",
"IMG_LINK" => "/static/img/recipes/2.jpg",
"NAME" => "Croissant",
"NOTE" => "4.5"
)
);
$A_array_categories = array(
"Type de cuisson" => $A_array_recipes_Type_de_cuisson,
"Temps de préparation" => $A_array_recipes_Type_de_cuisson,
@ -37,5 +37,5 @@ final class CategoriesController
View::show("category/view", $A_array_categories);
}
}

View File

@ -1,21 +1,30 @@
<?php
$allCategory = array(
"Type de cuisson" => "type_de_cuisson",
"Temps de préparation" => "temps_de_preparation",
"Difficulté" => "difficulte",
"Végan" => "vegan",
"Sans gluten" => "sans_gluten",
"Sans lactose" => "sans_lactose");
?>
<nav>
<ul>
<?php
foreach ($A_view as $categoryName => $recipes) {
echo '<li><section>
<h1>'.$categoryName.'</h1>
<ul>';
foreach ($recipes as $recipe) {
echo '<li>';
View::show("common/recipe", $recipe);
echo '</li>';
}
echo '</ul>
</section></li>';
}
?>
</ul>
</nav>
<?php
View::show("common/category_list");
?>
<main>
<?php
foreach ($A_view as $categoryName => $recipes) {
echo '<section id="'.$allCategory[$categoryName].'">
<h1>'.$categoryName.'</h1>
<ul>';
foreach ($recipes as $recipe) {
echo '<li>';
View::show("common/recipe", $recipe);
echo '</li>';
}
echo '</ul>
</section>';
}
?>
</main>

View File

@ -13,7 +13,7 @@ $allCategory = array(
<li><h3>Catégories :</h3></li>
<?php
foreach($allCategory as $category => $category_path) {
echo '<li><a href="/category/' . $category_path . '">'. $category . '</a></li>';
echo '<li><a href="/category#' . $category_path . '">'. $category . '</a></li>';
}?>
</ul>
</aside>