forked from bucksphp/bucksphp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
detail.php
48 lines (35 loc) · 1.05 KB
/
detail.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
<?php
// Include $shirts data array
include 'includes/data.php';
// id is passed in as a GET param via the URL (?id=)
$id = $_GET['id'];
// select the relevant shirt from our data array
$shirt = $shirts[$id];
// set a page title for the header template to use
$page_title = $shirt['name'];
// print header template
include 'includes/header.php';
?>
<div class="row">
<div class="col-sm-6">
<?php /* Print dynamic image tag */ ?>
<img src="<?php echo $shirt['image']; ?>"
alt="<?php echo $shirt['name']; ?>">
</div>
<div class="col-sm-6">
<?php /* Format price to 2 decimal points */ ?>
<h3>$<?php echo number_format($shirt['price'], 2); ?></h3>
<?php /* Print product description */ ?>
<p><?php echo $shirt['description']; ?></p>
<?php /* Print link to product on Etsy */ ?>
<p>
<a class="btn btn-primary" href="<?php echo $shirt['link']; ?>">Buy on Etsy</a>
</p>
</div>
</div>
<hr>
<a href="index.php">Back to all shirts</a>
<?php
// print HTML footer
include 'includes/footer.php';
?>