Created
November 28, 2010 17:04
-
-
Save wilburhimself/719095 to your computer and use it in GitHub Desktop.
Page controller básico
This file contains hidden or 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
| RewriteEngine on | |
| RewriteCond $1 !^(index\.php|favicon.ico|robots\.txt) | |
| RewriteRule ^(.*)$ index.php?/$1 [L] |
This file contains hidden or 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
| <?php | |
| function index() { | |
| include 'views/about.php'; | |
| } | |
| ?> |
This file contains hidden or 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
| <?php | |
| require_once 'header.php'; | |
| // La lógica del page controller aquí | |
| require_once 'footer.php'; | |
| ?> |
This file contains hidden or 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
| <?php | |
| $query = $_SERVER['QUERY_STRING']; | |
| $request = explode('/', $query); | |
| $controller = (!empty($request[1])) ? $request[1] : 'home'; | |
| $action = (!empty($request[2])) ? $request[2] : 'index'; | |
| $parameter = (!empty($request[3])) ? $request[3] : null ; | |
| include 'controllers/'.$controller.'.php'; | |
| call_user_func($action, $parameter); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment