summaryrefslogtreecommitdiffstats
path: root/productdetails.php
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-06-01 18:46:12 +0200
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-06-01 18:46:12 +0200
commitaf6dd5f8f9844596e85db25a8e97df9e08cb795c (patch)
tree8408e754dd335571635bcde041bbce69213af592 /productdetails.php
parentbe50d9ed4ba2b844bbc29686cee46b1dc149372a (diff)
downloadCatalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.tar.gz
Catalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.zip
Port alls sites to smarty and use the inheritance model
Diffstat (limited to 'productdetails.php')
-rw-r--r--productdetails.php80
1 files changed, 13 insertions, 67 deletions
diff --git a/productdetails.php b/productdetails.php
index 44f3e04..33fc6f5 100644
--- a/productdetails.php
+++ b/productdetails.php
@@ -1,5 +1,7 @@
<?php
session_start();
+require_once('vendor.inc.php');
+
if(isset($_GET['id']))
{
$id = $_GET['id'];
@@ -12,7 +14,6 @@ if(isset($_GET['catid']))
{
$catid = $_GET['catid'];
}
-require_once('vendor.inc.php');
$product = ProductQuery::create()->findOneById($id);
@@ -20,69 +21,14 @@ if ( !is_object($product) )
{
header('Location: categories.php');
}
-?>
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>Productdetails</title>
-<link rel="stylesheet" type="text/css" href="styles/style.css">
-</head>
-<body>
- <header><h1><?php echo $product->getName(); ?></h1></header>
- <nav>
- <dl>
- <dt><a href="contact.php">Contact us</a></dt>
- <dt><a href=".">Home</a></dt>
- <dt><a href="categories.php">Categories</a></dt>
- <dt><a href="products.php?id=<?php echo $catid; ?>">Back to Category</a></dt>
- <?php
- if(isset($_SESSION['username']))
- {
- echo "<dt><a href=\"login.php?logout\">Logout</a></dt>";
- }
- else
- {
- echo "<dt><a href=\"login.php\">Login</a></dt>";
- }
- ?>
- </dl>
- </nav>
- <div id="content">
- <form>
- <div class="row">
- <label for="name"><u>N</u>ame:</label>
- <input class="formw" type="text"
- placeholder="Name" id="name" name="name" accesskey="n"
- maxlength="100" readonly value="<?php echo $product->getName(); ?>">
- </div>
- <div class="row">
- <label for="price"><u>P</u>rice (Euro):</label>
- <input class="formw" type="text"
- placeholder="Price (Euro)" id="price" name="price" accesskey="p"
- maxlength="13" readonly value="<?php echo $product->getPrice(); ?>">
- </div>
- <div class="row">
- <label for="width"><u>W</u>idth (mm):</label>
- <input class="formw" type="text"
- placeholder="Width (mm)" id="width" name="width" accesskey="w"
- maxlength="11" readonly value="<?php echo $product->getWidth(); ?>">
- </div>
- <div class="row">
- <label for="height"><u>H</u>eight (mm):</label>
- <input class="formw" type="text"
- placeholder="Height (mm)" id="height" name="height" accesskey="h"
- maxlength="11" readonly value="<?php echo $product->getHeight(); ?>">
- </div>
- <div class="row">
- <label for="desc"><u>D</u>escription:</label>
- <textarea class="formw" placeholder="Description" id="desc" name="desc"
- accesskey="d" maxlength="1000" readonly rows="5"><?php echo $product->getDescription(); ?></textarea>
- </div>
- <div class="spacer">&nbsp;</div>
- </form>
- <div class="spacer"></div>
- </div>
- <footer>Copyright by SomeCompany Ltd.</footer>
-</body>
-</html> \ No newline at end of file
+
+$smarty = new Smarty;
+
+$smarty->assign('loggedin', isset($_SESSION['username']));
+$smarty->assign('product', $product);
+$smarty->assign('id', $id);
+$smarty->assign('catid', $catid);
+
+$smarty->display('productdetails.tpl')
+
+?> \ No newline at end of file