blob: 159179923954a99ea0712f25f68b8062f7615359 (
plain)
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
|
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
}
else
{
header('Location: categories.php');
}
require_once('vendor.inc.php');
$category = CategoryQuery::create()->findOneById($id);
if ( !is_object($category) )
{
header('Location: categories.php');
}
$products = $category->getProducts();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Products</title>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
<header><h1><?php echo $category->getName(); ?></h1></header>
<nav>
<dl>
<dt><a href="contact.html">Contact us</a></dt>
<dt><a href=".">Home</a></dt>
<dt><a href="categories.php">Categories</a></dt>
<dt><a href="login.html">Login</a></dt>
</dl>
</nav>
<div id="content">
<dl>
<?php
foreach( $products as $product ){
echo "<dt><a href=\"productdetails.php?id={$product->getId()}&catid={$id}\">{$product->getName()}</a></dt>";
echo "<dd>{$product->getDescription()}</dd>";
}
?>
</dl>
<div class="spacer"></div>
</div>
<footer>Copyright by SomeCompany Ltd.</footer>
</body>
</html>
|