This commit is contained in:
boris
2025-02-06 12:30:01 +00:00
parent f30a8fe711
commit f64a9eadbe
176 changed files with 21418 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?php require('template/header.phtml') ?>
<h3> How this MVC Template works </h3>
<p>Model-View-Controller (MVC) is an architectural pattern used in software engineering.</p><br>
<p>This MVC template takes a <i>Controller</i>, which responds to user inputs by gathering data, validating it, and passing to a <i>Model</i></p>
<p>The Model is typical to the function of a class, taking the inputs and manipulating it for the desired output to the <i>View</i></p>
<p>The View is what is then rendered to the user to return the results of the Model</p>
<?php require('template/footer.phtml') ?>

View File

@@ -0,0 +1,47 @@
<?php require('template/header.phtml') ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<div class="form-row align-items-center">
<div class="col-auto">
<label class="visually-hidden" for="convert">Convert</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">Convert</div>
</div>
<input class="form-control" id="convert" placeholder="Convert" type="text" name="number" value="<?php if(isset($_POST['number'])) echo $_POST['number'] ?>"/>
</div>
</div>
<div class="col-auto">
<label class="visually-hidden" for="fromUnit">From</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">From</div>
</div>
<select class="form-control" id="fromUnit" name="fromUnit">
<option>KM</option>
<option>Miles</option>
<option>Parsec</option>
</select>
</div>
</div>
<div class="col-auto">
<label class="visually-hidden" for="toUnit">To</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">To</div>
</div>
<select class="form-control" id="toUnit" name="toUnit">
<option>KM</option>
<option>Miles</option>
<option>Parsec</option>
</select>
</div>
</div>
<div class="col-auto">
<input class="btn btn-primary" type="submit" value="Submit" name="submit" />
</div>
</div>
</form>
<?php if(isset($view->result)) : ?>
<p><?php echo $view->result; ?></p>
<?php endif; ?>
<?php require('template/footer.phtml') ?>

View File

@@ -0,0 +1,11 @@
<?php require('template/header.phtml') ?>
<h2>Welcome to the web-site </h2>
<h3>A template for web-site development using the <i>Model-View-Controller</i> design pattern and <a href="https://getbootstrap.com/docs/5.2/getting-started/introduction/"><i>Bootstrap</i></a>.</h3>
<p>The <i>Views/template</i> directory contains a <i>header.phtml</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>
<?php require('template/footer.phtml') ?>

View File

@@ -0,0 +1,5 @@
<?php require('template/header.phtml') ?>
<h2>Welcome to Page1</h2>
<?php require('template/footer.phtml') ?>

View File

@@ -0,0 +1,15 @@
</main>
<footer class="row">
<div id="footer"> <!--class="col-xs-12"-->
<p>Web-site development using the MVC design pattern and the Bootstrap CSS framework</p>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
</body>
</html>

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link href="./css/my-style.css" rel="stylesheet">
<title>Server-Side Programming - <?php echo $view->pageTitle; ?></title>
</head>
<body role="document">
<div class="container">
<div class="row">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark p-3 border rounded">
<a class="navbar-brand" href="#"><img src="images/new_uos_logo.jpg" alt="Salford University" /></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target='#navbarToggle' aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle Navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggle">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item <?php if(str_contains($view->pageTitle, 'Home')) echo "active" ?>">
<a class="nav-link" href='index.php'>Home <?php if(str_contains($view->pageTitle, "Home")) echo "<span class='sr-only'>(Current)</span>" ?></a>
</li>
<li class="nav-item <?php if(str_contains($view->pageTitle, "Page1")) echo "active" ?>">
<a class="nav-link" href='page1.php'>Page 1 <?php if(str_contains($view->pageTitle, "Page1")) echo "<span class='sr-only'>(Current)</span>" ?></a>
</li>
<li class="nav-item <?php if(str_contains($view->pageTitle, 'Converter')) echo "active" ?>">
<a class="nav-link" href='converter.php'>Converter <?php if(str_contains($view->pageTitle, "Converter")) echo "<span class='sr-only'>(Current)</span>" ?></a>
</li>
<li class="nav-item <?php if(str_contains($view->pageTitle, 'Abouttemplate')) echo "active" ?>">
<a class="nav-link" href='abouttemplate.php'>About MVC <?php if(str_contains($view->pageTitle, "Abouttemplate")) echo "<span class='sr-only'>(Current)</span>" ?></a>
</li>
</ul>
</div>
</nav>
<main id="content"> <!--class="col-xs-6 col-sm-9 col-md-10"-->

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link href="./css/my-style.css" rel="stylesheet">
<title>Server-Side Programming - <?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">
<nav id="menu" class="col-xs-6 col-sm-3 col-md-2">
<h2 class="pb-2">Menu</h2>
<ul class="nav flex-column">
<li><a href="./index.php">Home</a></li>
<li><a href="./page1.php">Page 1</a></li>
<li><a href="./converter.php">Converter</a></li>
<li><a href="./abouttemplate.php">About MVC</a></li>
</ul>
</nav>
<main id="content" class="col-xs-6 col-sm-9 col-md-10">