diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-01 18:46:12 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-01 18:46:12 +0200 |
| commit | af6dd5f8f9844596e85db25a8e97df9e08cb795c (patch) | |
| tree | 8408e754dd335571635bcde041bbce69213af592 /categories.php | |
| parent | be50d9ed4ba2b844bbc29686cee46b1dc149372a (diff) | |
| download | Catalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.tar.gz Catalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.zip | |
Port alls sites to smarty and use the inheritance model
Diffstat (limited to 'categories.php')
| -rw-r--r-- | categories.php | 66 |
1 files changed, 7 insertions, 59 deletions
diff --git a/categories.php b/categories.php index 0425ec1..7760655 100644 --- a/categories.php +++ b/categories.php @@ -1,63 +1,11 @@ <?php session_start(); -?> -<!DOCTYPE html> -<html> -<head> -<meta charset="UTF-8"> -<title>Categories</title> -<link rel="stylesheet" type="text/css" href="styles/style.css"> -</head> -<body> -<header><h1>Categories</h1></header> -<nav> -<dl> -<dt><a href="contact.php">Contact us</a></dt> -<dt><a href=".">Home</a></dt> -<?php -if(isset($_SESSION['username'])) -{ - echo "<dt><a href=\"login.php?logout\">Logout</a></dt>"; - $username = $_SESSION['username']; -} -else -{ - echo "<dt><a href=\"login.php\">Login</a></dt>"; -} -?> -</dl> -</nav> -<div id="content"> -<table> -<?php - require_once('vendor.inc.php'); +require_once('vendor.inc.php'); + +$smarty = new Smarty; - $categories = CategoryQuery::create()->find(); +$smarty->assign('loggedin', isset($_SESSION['username'])); +$smarty->assign('categories', CategoryQuery::create()->find()); - foreach( $categories as $category ){ - echo "<tr>"; - echo "<td><a href=\"products.php?id={$category->getId()}\">{$category->getName()}</a></td>"; - echo "<td>{$category->getDescription()}</td>"; - if(isset($username)) - { - echo "<td><a href=\"categoryedit.php?modify={$category->getId()}\">Edit</a></td>"; - echo "<td><a href=\"categoryedit.php?delete={$category->getId()}\" onClick=\"return confirm('Confirm deletion.')\">Delete</a></td>"; - } - echo "</tr>"; - } - if(isset($username)) - { - echo "<tr>"; - echo "<td></td>"; - echo "<td></td>"; - echo "<td></td>"; - echo "<td><a href=\"categoryedit.php?add\">Add</a></td>"; - echo "</tr>"; - } -?> -</table> -<div class="spacer"></div> -</div> -<footer>Copyright by SomeCompany Ltd.</footer> -</body> -</html>
\ No newline at end of file +$smarty->display('categories.tpl'); +?>
\ No newline at end of file |
