/////////////////// Task 10 /CONTROLLER/controller.php //////////////
Show me a car"was clicked on the index.php page, then
$page = "CAR"; // give a variable named $page a value of "CAR", which we will use at the bottom of this page
break;
case "price": //PHP is case sensitive, so price and PRICE (in the line below is not the same). If the link "Show me it's price" was clicked on the index.php page, then
$page = "PRICE"; // give a $page a value of "PRICE", which we will use at the bottom of this page
break;
case "ferrari":
$page = "FERRARI";
break;
case "alldeals":
$page = "ALLDEALS";
break;
default: // If the link "Unsure what I want to see"was clicked on the index.php page, then
$page = "CAR"; // let us give $page a value of "CAR". Of course, we could have added this as another case, but one should always have a default to cover for unexpected problems
break;
}
}else { // The link Just let me in! was sent, so there was no key. Let's show them CAR.
$page = "CAR";
}
return $page; // show the function
}
if ($page=="PRICE") { //if $page is set to PRICE
$price = price(); // get the data on the proce by using the price()function in model.php
showPrice($price); // then call the function showPrice in view.php
} elseif($page=="CAR") { //if $page is set to CAR
$car = car();// get the data on the car by using the car()function in model.php
showCar($car); // then then call the function showCar in view.php to present the car's data to the user.
}elseif($page=="FERRARI"){
$car = ferrari();
showCar($car);
}elseif($page=="ALLDEALS"){
$car = alldeals();
showCar($car);
}else{
}
?>
//////////////////// Task 10 /Model/model.php ////////////////
//////////////// Task 10 /View/ view.php ///////////////////////
<'.'HEAD><'.'TITLE><'.'/TITLE><'.'/HEAD><'.'BODY>';
}
function htmlEnd() {
return '<'.'/BODY><'.'/HTML>';
}
?>
///////////////// Task 10 /Template/dealership.css////////////////
@charset "utf-8";
/* CSS Document */
body {
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
}
h1 {
font-size:14px;
}