Skip to content

Commit

Permalink
Added Custom 404 Pages for templates
Browse files Browse the repository at this point in the history
Had to modify default_routes to include 404_override = 'error/view'

Created the Error controller with the view method

The view method sets the page title and message to 404 Page Not Found, The page you are looking for could not be found.
  • Loading branch information
josev814 committed Oct 29, 2015
1 parent 9150548 commit b66e348
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/config/default_routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@
$route['checkout'] = 'billing/checkout';
$route['checkout/([a-zA-Z_-]+)'] = 'billing/checkout/$1';
$route['subscriptions'] = 'billing/subscriptions';
$route['subscriptions/(:any)'] = 'billing/subscriptions/$1';
$route['subscriptions/(:any)'] = 'billing/subscriptions/$1';

// 404 route
$route['404_override'] = 'error/view';
31 changes: 31 additions & 0 deletions app/modules/error/controllers/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
* Error Module
*
* Displays an error
*
* @author Jose' Vargas
* @copyright Jose' Vargas
* @package Hero Framework
*
*/

class Error extends Front_Controller {
function __construct() {
parent::__construct();
}

function view () {
$this->output->set_status_header('404');
$content = array(
'title' => '404 Page Not Found'
,'message' => 'The page you requested was not found.'
);

// show content
$this->smarty->assign($content);

return $this->smarty->display('error.thtml');
}
}
6 changes: 6 additions & 0 deletions themes/cubed/error.thtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{extends file="layout.thtml"}
{block name="title"}{$title} - {$smarty.block.parent}{/block}
{block name="content"}
<h1>{$title}</h1>
<p>{$message}</p>
{/block}
6 changes: 6 additions & 0 deletions themes/electric/error.thtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{extends file="layout.thtml"}
{block name="title"}{$title} - {$smarty.block.parent}{/block}
{block name="content"}
<h1>{$title}</h1>
<p>{$message}</p>
{/block}
6 changes: 6 additions & 0 deletions themes/night_jungle/error.thtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{extends file="layout.thtml"}
{block name="title"}{$title} - {$smarty.block.parent}{/block}
{block name="content"}
<h1>{$title}</h1>
<p>{$message}</p>
{/block}
6 changes: 6 additions & 0 deletions themes/orchard/error.thtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{extends file="layout.thtml"}
{block name="title"}{$title} - {$smarty.block.parent}{/block}
{block name="content"}
<h1>{$title}</h1>
<p>{$message}</p>
{/block}

0 comments on commit b66e348

Please sign in to comment.