Skip to content
Snippets Groups Projects
Commit c4d73a3c authored by DewanaGustavus's avatar DewanaGustavus
Browse files

fix: card template redirect when clicked any

parents ca2cf935 c74fdbb0
Branches
Tags
No related merge requests found
......@@ -34,7 +34,12 @@
</tr>
<tr>
<th>Description</th>
<td><?php echo $this->data['description'] ?></td>
<td><?php
if (!isset($data['description'])) {
echo '-';
} else {
echo $this->data['description'];
} ?></td>
</tr>
<tr>
<th>
......
<?php
function product_card_template($imgsrc, $name, $price, $text, $productId, $isManage = False) {
$hrefPart = "";
$href = "";
$redirectText = "";
if($isManage) {
$hrefPart = "<a href='/EditProduct/$productId'>Edit product</a>";
$href = "href='/EditProduct/$productId'";
$redirectText = "Edit product";
}else {
$hrefPart = "<a href='/product/$productId'>Add to cart</a>";
$href = "href='/product/$productId'";
$redirectText = "Add to cart";
}
$html = <<<"EOT"
<article>
<figure>
<img src="$imgsrc" alt="$name">
</figure>
<div class="article-preview">
<h2>$name</h2>
<h4>$price</h4>
<p>$text</p>
$hrefPart
</div>
<a $href>
<figure>
<img src="$imgsrc" alt="$name">
</figure>
<div class="article-preview">
<h2>$name</h2>
<h4>$price</h4>
<p>$text</p>
<h1>$redirectText</h1>
</div>
</a>
</article>
EOT;
......
......@@ -5,7 +5,8 @@ class ProfileController extends Controller
public function index()
{
if($this->userRole === 0) {
throw new Exception("You are not allowed to view this page", 405);
header("Location: /login");
exit();
}
$userModel = $this->model("UserModel");
......
......@@ -33,11 +33,17 @@
}
.articles article a{
display: inline-flex;
color: #DD946F;
color: #000000;
text-decoration: none;
}
.articles article h1{
margin: 0 0 10px 0;
font-size: 1.2rem;
color: #DD946F;
transition: color 0.3s ease-out;
}
.articles article h2{
margin: 0 0 10px 0;
font-size: 1.6rem;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment