Commit 7eeebe64 authored by Sorrel Harriet's avatar Sorrel Harriet
Browse files

initial work on lecture 6 task resources

parent 023ecb31
<?php
if (isset($_GET['id'])) {
$myvar = $_GET['id'];
} else {
$myvar = 'home';
}
$html = "<!DOCTYPE html
<html>
<head>
<meta charset='utf-8'/>
<title>Music Store: $myvar</title>
</head>
<body>";
$html .= "<nav><ul><a href='index_v1.php?id=home'>Home</a></li>";
$html .= "<li><a href='index_v1.php?id=customers'>Customers</a></li>";
$html .= "<li><a href='index_v1.php?id=orders'>Orders</a></li></ul></nav>";
switch ($myvar) {
case 'home' : include 'views/home.php';
break;
case 'customers' :
include 'views/customers.php';break;
case 'orders' :
include 'views/orders.php' break;
default :
include 'views/404.php';}
$html .= "</body></html>";echo$html;
?>
<?php
// include the header HTML
include('templates/header.html');
// include the navigation HTML
include('templates/nav.html');
// define variable for storing body HTML
$html = "";
// check if 'page' parameter is set in query string
if (isset($_GET['page'])) {
$page = $_GET['page']; // if so, set page variable to value of 'page' parameter
} else {
$page = 'home'; // if not, set page variable to home
}
// determine which view to serve based on value of $page
switch ($page) {
case 'home' :
include 'views/home.php';
break;
case 'customers' :
include 'views/customers.php';
break;
case 'orders' :
include 'views/orders.php'
break;
default :
include 'views/404.php';
}
// output body HTML
echo $html;
// include the footer HTML
include('templates/footer.html');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>Music Store: {{ page }}</title>
</head>
<body>
<nav>
<ul>
<a href='index_v2.php?page=home'>Home</a></li>
<li><a href='index_v2.php?page=customers'>Customers</a></li>
<li><a href='index_v2.php?page=orders'>Orders</a></li>
</ul>
</nav>
<?php
$html .= "<h1>Oops!</h1>";
$html .= "<p>Sorry, the page you're looking for cannot be found.</p>";
?>
<?php
$html .= "<h1>Customers</h1>";
$html .= "<p>Browse the app's customers here...maybe add/delete/edit customers too...whatever.</p>";
?>
<?php
$html .= "<h1>Welcome to the Music Store</h1>";
$html .= "<p>Some content here...</p>";
?>
<?php
$html .= "<h1>Orders</h1>";
$html .= "<p>Browse the orders here...maybe add/delete/edit/mark dispatched...whatever.</p>";
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment