aboutsummaryrefslogtreecommitdiff
path: root/public/products.php
blob: 433475f663404b95c025ccd2e1a7bbb04ba11bc1 (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
<!DOCTYPE html>
<?php require "../lib/db.php"; ?>
<?php 
function product_template($product) {
	$image_path = $product->image ? "/img/product/$product->id-thumb.jpg" : "/img/placeholder.png";
	echo <<<"EOF"
	<a href="/product.php?id=$product->id" class="product nolinkstyle">
		<img src="$image_path" alt="">
		<span class="price">$product->price</span>
		<span class="name">$product->name</span>
	</a>
EOF;
}
?>
<html>
<head>
	<?php include 'head.php' ?>
	<title>producten</title>
	<link rel='stylesheet' type='text/css' media='screen' href='products.css'>
</head>
<body>
	<?php include 'navbar.php' ?>
	<div class="main limwidth">
		<h2>lijst met producten:</h2>
		<div class="products">
			<?php
				$res = $cursor->query("select id, image, price, name from webs.product");
				while ($product = $res->fetch_object()) product_template($product);
			?>
		</div>
	</div>
	<?php include 'footer.php' ?>
</body>
</html>