Created custom 404 error handling

This commit is contained in:
Gregory Ballantine 2016-11-28 18:08:26 -05:00
parent f2ca6af5bc
commit 85e434dd83
3 changed files with 28 additions and 7 deletions

View File

@ -1,12 +1,15 @@
<?php <?php
// Home view(s) // Main view routes
require 'routes/index.php'; require 'routes/pages/index.php';
require 'routes/about.php'; require 'routes/pages/about.php';
require 'routes/contact.php'; require 'routes/pages/contact.php';
require 'routes/home.php'; require 'routes/pages/home.php';
require 'routes/music.php'; require 'routes/pages/music.php';
require 'routes/shows.php'; require 'routes/pages/shows.php';
// API routes // API routes
require 'routes/apiv1/music.php'; require 'routes/apiv1/music.php';
// Errors
require 'routes/errors/404.php';

View File

@ -0,0 +1,5 @@
<?php
$app->notFound(function() use ($app) {
$app->render('errors/404.twig');
});

13
app/views/errors/404.twig Normal file
View File

@ -0,0 +1,13 @@
{% extends 'templates/default.twig' %}
{% block title %}404 Error{% endblock %}
{% block content %}
<!-- Error information section -->
<section id="error-section" class="row">
<div class="col-xs-12 card hover-box shadow-1">
<h4>404 Error</h4>
<p>The URL you were looking for doesn't exist. Perhaps you'd like to start over at the <a href="{{ urlfor('home') }}">home page</a>?</p>
</div>
</section>
{% endblock %}