Commit eb6f5bed authored by Sorrel Harriet's avatar Sorrel Harriet
Browse files

replacing week 1 test app

parent 4ecac790
*********************************
* A TEST APPLICATION *
*********************************
Description
-----------
This is a test PHP application. You can upload use it to test your LAMP stack. You can also browse the directory structure to get an idea of how PHP web applications are commonly structured. You can also read this README file to find out the sorts of things that should be included in a README file!
Author & Contact
----------------
Sorrel Harriet s.harriet@gold.ac.uk
Installation Instructions
-------------------------
Upload the application to your web root folder. No further actions needed!
Configuration Instructions
--------------------------
There is nothing to configure.
<?php
# Write some helper functions here...
?>
<?php
// Code to detect whether index.php has been requested without query string
// If no page parameter detected...
if (!isset($_GET['page'])) {
$id = 'home'; // display home page
} else {
$id = $_GET['page']; // else requested page
}
$content = '';
// Switch statement to decide content of page will go here.
// Regardless of which "view" is displayed, the variable $content will
switch ($id) {
case 'home' :
include 'views/home.php';
break;
case 'page_2' :
include 'views/page_2.php';
break;
default :
include 'views/404.php';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test Application</title>
</head>
<body>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="index.php?page=page_2">Page 2</a></li>
</ul>
<?php
// Display content for requested view.
echo $content;
?>
</body>
</html>
<?php
$content = "<h1>Page not found</h1>";
$content .= "<p>Sorry, the page you requested could not be found.</p>";
?>
<?php
$content = '<h1>Hello world!</h1>';
$content .= '<p>If you\'re reading this, it means you have successfully launched the <b>test app</b>.</p>'
?>
<?php
$content = '<h1>Welcome to page 2!</h1>';
?>
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