Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getPage(){
- return (isset($_GET['pg'])) ? array_filter(explode('/', $_GET['pg']), 'noEmpty') : array('home');
- }
- function noEmpty($item){
- return !(empty($item));
- }
- /*Retorna a pagina q será incluida*/
- function getIncludePage(){
- $page = getPage();
- if(file_exists("arquivos/$page.php")){
- $path = "arquivos/$page.php";
- }else{
- $path = "arquivos/error.php";
- }
- include_once($path);
- }
- /*Retorna o primeiro parâmetro depois da pagina*/
- function getFirstParam(){
- $page = getPage();
- return (isset($page[1])) ? $page[1] : 0;
- }
- /*Retorna num numero de paginação*/
- function getNumberPagination(){
- $page = getPage();
- return (isset($page[1]) && $page == 'page' && isset($page[2])) ? (int)$page[2] : 1;
- }
- ?>
Add Comment
Please, Sign In to add comment