-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
46 lines (34 loc) · 1.15 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
//This is the main controller
//Get the database connection file
require_once 'library/connections.php';
//Get the main model for use as needed
require_once 'model/main-model.php';
//Get the array of classifications from DB using model
$classifications = getClassifications();
//var_dump($classifications);
//exit;
// Build a navigation bar using the $classifications array
$navList = '<ul>';
$navList .= "<li><a href='/phpmotors/index.php' title='View the PHP Motors home page'>Home</a></li>";
foreach ($classifications as $classification) {
$navList .= "<li><a href='/phpmotors/index.php?action=".urlencode($classification['classificationName'])."' title='View our $classification[classificationName] product line'>$classification[classificationName]</a></li>";
}
$navList .= '</ul>';
//echo $navList;
//exit;
$action = filter_input(INPUT_POST, 'action');
if ($action == NULL){
$action = filter_input(INPUT_GET, 'action');
}
switch ($action){
case 'template':
include 'view/template.php';
break;
case 'registration':
include 'view/registration.php';
break;
default:
include 'view/home.php';
}
?>