diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-05 19:34:39 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-05 19:34:39 +0200 |
| commit | 705c4cb50eea66585cc95c7314001fce9dd197cd (patch) | |
| tree | 4a448f4e30b117e12306b643121f49da15e6376b /products.php | |
| download | Catalog-705c4cb50eea66585cc95c7314001fce9dd197cd.tar.gz Catalog-705c4cb50eea66585cc95c7314001fce9dd197cd.zip | |
Initial commit
Diffstat (limited to 'products.php')
| -rw-r--r-- | products.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/products.php b/products.php new file mode 100644 index 0000000..b8391d9 --- /dev/null +++ b/products.php @@ -0,0 +1,45 @@ +<?php +if(isset($_GET['id'])) +{ + $id = $_GET['id']; +} +else +{ + header('Location: categories.php'); +} +require_once('vendor.inc.php'); + +$category = CategoryQuery::create()->filterById($id)->findOne(); +$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()}\">{$product->getName()}</a></dt>"; + echo "<dd>{$product->getDescription()}</dd>"; +} +?> +</dl> +<div class="spacer"></div> +</div> +<footer>Copyright by SomeCompany Ltd.</footer> +</body> +</html>
\ No newline at end of file |
