Skip to content

Commit d8da42d

Browse files
committed
Defaulting to bootstrap.
1 parent 56125d2 commit d8da42d

File tree

6 files changed

+30
-14
lines changed

6 files changed

+30
-14
lines changed

template/app/src/WebAppFramework/Template.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ public function setVariable($name, $value)
3333
* @param $templateFileName
3434
*/
3535
public function insertTemplate($templateFileName)
36-
{
37-
require(APP_LOCATION . '/templates/' . $templateFileName);
38-
}
39-
40-
public function render()
4136
{
4237
// Add normal escaped variables to the template
4338
foreach ($this->rawVariables as $name => $value) {
4439
// Yes I want to explode out the variables here by name
4540
$$name = htmlentities($value);
4641
}
4742

48-
require(APP_LOCATION . '/templates/' . $this->phpTemplateFile);
43+
require(APP_LOCATION . '/templates/' . $templateFileName);
44+
}
45+
46+
public function render()
47+
{
48+
$this->insertTemplate($this->phpTemplateFile);
4949
}
5050
}

template/app/templates/footer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
2+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
3+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
14
</body>
25
</html>

template/app/templates/header.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
<html>
1+
<!doctype html>
2+
<html lang="en">
23
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
38
<title>Your Website Name</title>
9+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
10+
<link rel="stylesheet" href="/css/main.css">
411
</head>
512
<body>

template/app/templates/home.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php $this->insertTemplate('header.php'); ?>
22
<?php $this->insertTemplate('users/loginBar.php'); ?>
3-
Hello <?php echo(($name) ? $name : 'world'); ?>!
4-
<form action="" method="post">
5-
Your Name:<input type="text" name="name" value="<?php echo $name; ?>">
6-
<input type="submit" value="Submit">
7-
</form>
3+
<div class="container">
4+
<h1>Hello <?php echo(($name) ? $name : 'world'); ?>!</h1>
5+
<form action="" method="post">
6+
Your Name:<input type="text" name="name" value="<?php echo $name; ?>">
7+
<input type="submit" value="Submit">
8+
</form>
9+
</div>
810
<?php $this->insertTemplate('footer.php'); ?>

template/app/templates/users/loginBar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<div id="login-bar" class="top-bar">
1+
<div id="login-bar" class="top-bar container-fluid text-right">
22
<?php
33
if (\Di\Di::getAuth()->isLoggedIn()) {
44
$user = \Di\Di::getAuth()->getLoggedInUser();
55
?>
66
You are logged in as <?php echo $user->getFirstName(); ?> <?php echo $user->getLastName(); ?>. <a href="/Auth/logout">Log Out</a>
77
<?php } else { ?>
8-
Please log in!
98
<form action="/Auth/login" method="post">
9+
Log In
1010
Email:<input type="text" name="email" value="">
1111
Password:<input type="password" name="password" value="">
1212
<input type="submit" value="Submit">

template/public_html/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.top-bar {
2+
color: #FFF;
3+
background-color: #000;
4+
}

0 commit comments

Comments
 (0)