Skip to content

Commit 40dca2a

Browse files
committed
Adding 404 template
1 parent a8add84 commit 40dca2a

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

_tuts/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@
3636
"description": null
3737
}
3838
],
39-
"sha": "9df330d4c89cd6b6ce1a72e75884e9854206ddb0"
39+
"sha": "a8add84da30129e049139e5a713c09059d7b7786"
4040
}

_tuts/twig.diff

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ index 5dfd2c3..fdd8c16 100644
8989
"version": "2.3.3",
9090
"target-dir": "Zend/Log",
9191
diff --git a/controllers.php b/controllers.php
92-
index 9adb562..4de8eb7 100644
92+
index 9adb562..b986cd9 100644
9393
--- a/controllers.php
9494
+++ b/controllers.php
9595
@@ -8,13 +8,10 @@ use Pimple\Container;
@@ -110,10 +110,11 @@ index 9adb562..4de8eb7 100644
110110

111111
return new Response($content);
112112
}
113-
@@ -23,17 +20,11 @@ function attendees_controller(Request $request, Container $c) {
113+
@@ -22,25 +19,17 @@ function homepage_controller(Request $request) {
114+
function attendees_controller(Request $request, Container $c) {
114115
$dbh = $c['connection'];
115116

116-
$sql = 'SELECT * FROM php_camp';
117+
- $sql = 'SELECT * FROM php_camp';
117118
- $content = '<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />';
118119
- $content .= '<h1>PHP Camp Attendees</h1>';
119120
- $content .= '<table class="table" style="width: 300px;">';
@@ -125,14 +126,23 @@ index 9adb562..4de8eb7 100644
125126
- );
126127
- }
127128
- $content .= '</table>';
128-
+ $campers = $dbh->query($sql);
129+
+ $campers = $dbh->query('SELECT * FROM php_camp');
129130
+
130131
+ $content = $c['twig']->render('attendees.twig', array(
131132
+ 'campers' => $campers
132133
+ ));
133134

134135
return new Response($content);
135136
}
137+
138+
-function error404_controller(Request $request) {
139+
- $content = '<h1>404 Page not Found</h1>';
140+
- $content .= '<p>Find a boy (or girl) scout - they can fix this!</p>';
141+
+function error404_controller(Request $request, Container $c) {
142+
+ $content = $c['twig']->render('error404.twig');
143+
144+
$response = new Response($content);
145+
$response->setStatusCode(404);
136146
diff --git a/services.php b/services.php
137147
index b0b1542..1a0248d 100644
138148
--- a/services.php
@@ -169,6 +179,15 @@ index 0000000..106ec00
169179
+ </tr>
170180
+ {% endfor %}
171181
+</table>
182+
diff --git a/views/error404.twig b/views/error404.twig
183+
new file mode 100644
184+
index 0000000..27f565e
185+
--- /dev/null
186+
+++ b/views/error404.twig
187+
@@ -0,0 +1,3 @@
188+
+
189+
+<h1>404 Page not Found</h1>
190+
+<p>Find a boy (or girl) scout - they can fix this!</p>
172191
diff --git a/views/homepage.twig b/views/homepage.twig
173192
new file mode 100644
174193
index 0000000..fbe632e

0 commit comments

Comments
 (0)