Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
data-networks-web
lab-exercises
Commits
7eeebe64
Commit
7eeebe64
authored
Nov 12, 2016
by
Sorrel Harriet
Browse files
initial work on lecture 6 task resources
parent
023ecb31
Changes
9
Hide whitespace changes
Inline
Side-by-side
lab-6/lecture-task/index_v1.php
0 → 100644
View file @
7eeebe64
<?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
;
?>
lab-6/lecture-task/index_v2.php
0 → 100644
View file @
7eeebe64
<?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'
);
?>
lab-6/lecture-task/templates/footer.html
0 → 100644
View file @
7eeebe64
</body>
</html>
lab-6/lecture-task/templates/header.html
0 → 100644
View file @
7eeebe64
<!DOCTYPE html>
<html>
<head>
<meta
charset=
'utf-8'
/>
<title>
Music Store: {{ page }}
</title>
</head>
<body>
lab-6/lecture-task/templates/nav.html
0 → 100644
View file @
7eeebe64
<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>
lab-6/lecture-task/views/404.php
0 → 100644
View file @
7eeebe64
<?php
$html
.
=
"<h1>Oops!</h1>"
;
$html
.
=
"<p>Sorry, the page you're looking for cannot be found.</p>"
;
?>
lab-6/lecture-task/views/customers.php
0 → 100644
View file @
7eeebe64
<?php
$html
.
=
"<h1>Customers</h1>"
;
$html
.
=
"<p>Browse the app's customers here...maybe add/delete/edit customers too...whatever.</p>"
;
?>
lab-6/lecture-task/views/home.php
0 → 100644
View file @
7eeebe64
<?php
$html
.
=
"<h1>Welcome to the Music Store</h1>"
;
$html
.
=
"<p>Some content here...</p>"
;
?>
lab-6/lecture-task/views/orders.php
0 → 100644
View file @
7eeebe64
<?php
$html
.
=
"<h1>Orders</h1>"
;
$html
.
=
"<p>Browse the orders here...maybe add/delete/edit/mark dispatched...whatever.</p>"
;
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment