Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d67093c

Browse files
Error page 404 por default cuando no se encuentre el controlador y metodo exec cuando no se encuentre el metodo
1 parent 82cf980 commit d67093c

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
class ErrorPageController extends Controller
6+
{
7+
public $path_inicio;
8+
9+
public function __construct()
10+
{
11+
$this->path_inicio = FOLDER_PATH;
12+
}
13+
14+
public function exec()
15+
{
16+
$this->render(__class__, array('path_inicio' => $this->path_inicio));
17+
}
18+
}

‎app/views/ErrorPage/ErrorPage.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Error 404</title>
5+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
6+
</head>
7+
<body>
8+
<!-- Main jumbotron for a primary marketing message or call to action -->
9+
<div class="container text-center">
10+
<h1>Error 404</h1>
11+
<h2>Oops! Página no encontrada</h2>
12+
<a href="<?php echo $path_inicio ?>">Ir a inicio</a>
13+
</div>
14+
</body>
15+
</html>

‎index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
$param = $router->getParam();
1010

1111
if(!CoreHelper::validateController($controller))
12-
thrownewException("Controlador $controller no fue encontrado");
12+
$controller = 'ErrorPage';
1313

1414
require PATH_CONTROLLERS . "{$controller}/{$controller}Controller.php";
1515

1616
$controller .= 'Controller';
1717

1818
if(!CoreHelper::validateMethodController($controller, $method))
19-
thrownewException("El método {$method} del controlador {$controller} no fue encontrado");
19+
$method = 'exec';
2020

2121
$controller = new $controller;
2222

‎system/config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
define('HELPER_PATH', 'system/helpers/');
1919

20+
define('FOLDER_PATH', '/php-mvc');
21+
2022
//////////////////////////////////////
2123
// Valores de core
2224
/////////////////////////////////////

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /