add template files and compose file, fix syntax errors in template
This commit is contained in:
@@ -1,11 +1,32 @@
|
||||
<?php require('template/header.phtml') ?>
|
||||
|
||||
<h3>Welcome to the web-site </h3>
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<p><?php echo $view->dbMessage; ?></p>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<p>Current script <?php echo $_SERVER["PHP_SELF"]; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>A template for web-site development using the <i>Model-View-Controller</i> design pattern and <a href="http://www.getbootstrap.com/css"><i>Bootstrap</i></a>.</h3>
|
||||
<p>The <i>Views/template</i> directory contains a <i>header.phtl</i> and a <i>footer.phtml</i> which should be included on every new page generated.
|
||||
To add additional pages just edit the file <i>header.phtml</i> to add the extra link and then add a new <i>Controller (pageN.php)</i> and a new <i>View (pageN.phtml)</i>, for each page required.</p>
|
||||
<p>The <i>Model</i> code files are placed in the <i>Models</i> directory.</p>
|
||||
<p>Do not change any of the css files in the <i>css</> directory!<p>
|
||||
<div class="row">
|
||||
<table class="table table-bordered">
|
||||
<thead> <tr> <th>Facility ID</th> <th>Title</th> <th>Category</th> <th>Description</th> <th>Address</th> <th>Postcode</th> <th>Lat/Long</th> <th>Contributor</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($view->facilityDataSet as $facilityData) {
|
||||
echo '<tr> <td>' . $facilityData->getId() .
|
||||
'</td> <td>' . $facilityData->getTitle() .
|
||||
'</td> <td>' . $facilityData->getCategory() .
|
||||
'</td> <td>' . $facilityData->getDescription() .
|
||||
'</td> <td>' . $facilityData->getHouseNumber() . " " . $facilityData->getStreetName() . " " . $facilityData->getCounty() . " " . $facilityData->getTown() .
|
||||
'</td> <td>' . $facilityData->getPostcode() .
|
||||
'</td> <td>' . $facilityData->getLatitude() . " " . $facilityData->getLongitude() .
|
||||
'</td> <td>' . $facilityData->getContributor() .
|
||||
'</td> </td> </tr>';
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php require('template/footer.phtml') ?>
|
||||
|
||||
<?php require('template/footer.phtml') ?>
|
@@ -1,5 +0,0 @@
|
||||
<?php require('template/header.phtml') ?>
|
||||
|
||||
<h3>Welcome to Page1</h3>
|
||||
|
||||
<?php require('template/footer.phtml') ?>
|
@@ -1,5 +0,0 @@
|
||||
<?php require('template/header.phtml') ?>
|
||||
|
||||
<h3>Welcome to Page2</h3>
|
||||
|
||||
<?php require('template/footer.phtml') ?>
|
@@ -3,7 +3,8 @@
|
||||
|
||||
<div class="row">
|
||||
<div id="footer" class="col-xs-12">
|
||||
<p>Web-site development using the MVC design pattern and the Bootstrap CSS framework</p>
|
||||
<p>George Wilkinson @2024</p>
|
||||
<p>Powered by Bootstrap</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bootstrap core JavaScript
|
||||
|
@@ -14,55 +14,54 @@
|
||||
<link href="/css/bootstrap-theme.css" rel="stylesheet">
|
||||
<link href="/css/my-style.css" rel="stylesheet">
|
||||
|
||||
<title>Server-Side Programming - <?php echo $view->pageTitle; ?></title>
|
||||
<title>Ecobuddy - <?php echo $view->pageTitle; ?></title>
|
||||
</head>
|
||||
|
||||
<body role="document">
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div id="title" class="col-xs-12">
|
||||
<img src="/images/new_uos_logo.jpg" alt="Salford University" />
|
||||
<div class="pull-right"> <h1><?php echo $view->pageTitle ?> </h1></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div id="menu" class="col-xs-6 col-sm-3 col-md-2">
|
||||
<ul class="nav navbar_default nav-stacked">
|
||||
<nav class="navbar navbar-expand-lg m-2 border rounded-2">
|
||||
<div class="container-fluid">
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/index.php">Ecobuddy <?php echo $view->pageTitle?></a>
|
||||
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/index.php">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" aria-disabled="true">Disabled</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<form class="d-flex" role="search">
|
||||
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn bg-light btn-outline-light text-dark" type="submit">Search</button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
if (!isset($_SESSION["login"])) {
|
||||
echo '
|
||||
<form method="post" action="" class="form text-primary">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" name="username">
|
||||
<label for="password">Password</label>
|
||||
<input type="text" name="password">
|
||||
<input type="submit" name="loginbutton" value="Login">
|
||||
|
||||
</form>';
|
||||
if ($view->loginError) {
|
||||
require_once('Views/template/loginError.phtml');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '
|
||||
<form method="post" action="" class="form text-primary">
|
||||
<input type="submit" name="logoutbutton" value="Logout">
|
||||
</form>';
|
||||
if(!$user->isLoggedIn()) {
|
||||
require_once('Views/template/loginModal.phtml');
|
||||
}
|
||||
if($user->isLoggedIn()) {
|
||||
require_once('Views/template/logoutButton.phtml');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<body role="document">
|
||||
|
||||
<li><a href="/index.php">Home</a></li>
|
||||
<li><a href="/page1.php">Page1</a></li>
|
||||
<li><a href="/page2.php">Page2</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container-lg">
|
||||
|
||||
<div id="content" class="col-xs-6 col-sm-9 col-md-10">
|
||||
|
||||
<div id="content" >
|
||||
|
||||
|
||||
|
||||
|
0
Views/template/loginError.phtml
Normal file
0
Views/template/loginError.phtml
Normal file
29
Views/template/loginModal.phtml
Normal file
29
Views/template/loginModal.phtml
Normal file
@@ -0,0 +1,29 @@
|
||||
<button type="button" class="btn bg-primary btn-outline-primary text-light m-1 ms-2" data-bs-toggle="modal" data-bs-target="#loginModal">
|
||||
Login
|
||||
</button>
|
||||
<div class="modal fade" id="loginModal" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="loginModalLabel">Login</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="Username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn bg-primary btn-outline-primary text-light" name="loginButton">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-warning" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
4
Views/template/logoutButton.phtml
Normal file
4
Views/template/logoutButton.phtml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php echo "<p class='nav-link m-2' style='color: black;'>" . $user->getUsername() . " is logged in.</p>"?>
|
||||
<form class="form-inline my-2 my-lg-0" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ">
|
||||
<input class="btn bg-danger btn-outline-danger text-light" type="submit" name="logoutButton" value="Logout">
|
||||
</form>
|
0
Views/template/pagination.phtml
Normal file
0
Views/template/pagination.phtml
Normal file
Reference in New Issue
Block a user