-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #727 from LuckyCyborg/master
Split the Core\Error Controller part to App\Controllers\Error
- Loading branch information
Showing
7 changed files
with
59 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
*/ | ||
class Demo extends Controller | ||
{ | ||
|
||
/** | ||
* Call the parent construct | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
namespace App\Controllers; | ||
|
||
use Core\Controller; | ||
use Core\View; | ||
|
||
/** | ||
* Error controller to generate 404 pages. | ||
*/ | ||
class Error extends Controller | ||
{ | ||
/** | ||
* Call the parent construct. | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Load a 404 page with the Error message. | ||
*/ | ||
public function index($error) | ||
{ | ||
$data['title'] = '404'; | ||
$data['error'] = $error; | ||
|
||
View::addHeader("HTTP/1.0 404 Not Found"); | ||
|
||
View::renderTemplate('header', $data); | ||
View::render('Error/404', $data); | ||
View::renderTemplate('footer', $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,18 @@ | ||
<?php | ||
/** | ||
* Error class - calls a 404 page. | ||
* Error class. | ||
* | ||
* @author David Carr - [email protected] | ||
* @version 3.0 | ||
*/ | ||
|
||
namespace Core; | ||
|
||
use Core\Controller; | ||
use Core\View; | ||
|
||
/** | ||
* Error class to generate 404 pages. | ||
* Error class. | ||
*/ | ||
class Error extends Controller | ||
class Error | ||
{ | ||
/** | ||
* $error holder. | ||
* | ||
* @var string | ||
*/ | ||
private $error = null; | ||
|
||
/** | ||
* Save error to $this->error. | ||
* | ||
* @param string $error | ||
*/ | ||
public function __construct($error = null) | ||
{ | ||
parent::__construct(); | ||
$this->error = $error; | ||
} | ||
|
||
/** | ||
* Load a 404 page with the error message. | ||
*/ | ||
public function index($error = null) | ||
{ | ||
header("HTTP/1.0 404 Not Found"); | ||
|
||
$data['title'] = '404'; | ||
$data['error'] = $error ? $error : $this->error; | ||
|
||
View::renderTemplate('header', $data); | ||
View::render('Error/404', $data); | ||
View::renderTemplate('footer', $data); | ||
} | ||
|
||
/** | ||
* Display errors. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters