-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.php
89 lines (83 loc) · 4.33 KB
/
blog.php
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<?php
require_once("header.php");
if (isset($_SESSION['modifyByAdmin']) && isset($_SESSION['modifyByAdmin']) == true) {
$_SESSION['modifyByAdmin'] = false;
}
?>
<link rel="stylesheet" href="blog.css">
</head>
<body>
<div class="container-fluid ">
<?php
require_once("callingLogin.php");
require_once("navbar.php");?>
<header class="text-center logo">
<h1 style="font-size: 65px"> The Tastiest Recipes</h1>
</header>
<div id="top"></div>
<?php
$stmt = $dbh->getInstance()->prepare("SELECT Recipes.IdRecipe, Images.IdImage, Recipes.Title, Images.Path FROM RecipesImages INNER JOIN Recipes on Recipes.IdRecipe=RecipesImages.IdRecipe INNER JOIN Images ON Images.IdImage=RecipesImages.IdImage WHERE State=true");
$stmt->execute();
$titles = array();
$paths = array();
for ($cnt = $stmt->rowCount(); $cnt > 0; --$cnt) { //questo ciclo farà in modo di stampare a video le immagini di ogni ricetta con all'ineterno il titolo della ricetta.
$row = $stmt->fetch();
//echo $row['Title'].' ';
$explode = explode(';', $row['Title']);
$titles[] = $explode[0];
$subtitles[] = $explode[1];
$idRecipes[] = $row['IdRecipe'];
$paths[] = $row['Path'];
}
for ($i = 0; $i < sizeof($titles); ++$i) {
echo '<div class="row">';
echo '<div class="col-lg-6 mb-3 mb-lg-0" style="margin-top: 12px !important; margin-bottom: 12px !important ">
<a href="recipe.php?recipe=' . $idRecipes[$i] . '">
<div class="hover hover-1 text-white box rounded"><img src="' . $paths[$i] . '" alt="' . $titles[$i] . '">
<div class="hover-overlay"></div>
<div class="hover-1-content px-5 py-4">
<h3 class="hover-1-title text-uppercase font-weight-bold mb-0"> <span class="sublogo" style="font-size: 30px"><b>' . $titles[$i] . '</b> </span></h3>
<p class="hover-1-description sublogo mb-0" style="font-size: 18px">' . $subtitles[$i] . '</p>
</div>
</div>
</a>
</div>';
++$i;
if (isset($paths[$i])) {
echo '<div class="col-lg-6" style="margin-top: 12px !important; margin-bottom: 12px !important">
<a href="recipe.php?recipe=' . $idRecipes[$i] . '">
<div class="hover hover-1 text-white box rounded"><img src="' . $paths[$i] . '" alt="' . $titles[$i] . '">
<div class="hover-overlay"></div>
<div class="hover-1-content px-5 py-4">
<h3 class="hover-1-title text-uppercase font-weight-bold mb-0"> <span class="sublogo" style="font-size: 30px"><b>' . $titles[$i] . '</b> </span></h3>
<p class="hover-1-description sublogo mb-0" style="font-size: 18px">' . $subtitles[$i] . '</p>
</div>
</div>
</a>
</div>';
echo '</div>'; //row
}
}
if (isset($_SESSION['Category']) && $_SESSION['Category'] == 'Chef') {
echo '<div class="row d-flex justify-content-center">
<div class="col-lg-6" style="margin-top: 12px !important; margin-bottom: 12px !important">
<a href="InsertNewRecipe.php">
<div class="hover hover-1 text-white box rounded"><img src="Images/InsertNewRecipe.jpeg" alt="Insert a new product">
<div class="hover-overlay"></div>
<div class="hover-1-content px-5 py-4">
<h3 class="hover-1-title text-uppercase font-weight-bold mb-0"></h3>
<p class="hover-1-description sublogo mb-0" style="font-size: 18px">
</p>
</div>
</div>
</a>
</div>
</div>';
}
?>
</div> <!-- contriner -->
<?php require_once("footer.php"); ?>
</html>