Advertisement
Guest User

Untitled

a guest
May 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function getHome()
  2. {
  3. $url = $_GET['url'];
  4. $url = explode('/', $url);
  5. $url[0] = ($url[0] == NULL ? 'index' : $url[0]);
  6.  
  7. if(file_exists('tpl/'.$url[0].'.php')){
  8. require_once('tpl/'.$url[0].'.php');
  9. }elseif(file_exists('tpl/'.$url[0].'/'.$url[1].'.php')){
  10. require_once('tpl/'.$url[0].'/'.$url[1].'.php');
  11. }else{
  12. require_once('tpl/404.php');
  13. }
  14. }
  15.  
  16. $url = 'index';
  17. if(isset($_GET['url'])) {
  18. $url = $_GET['url'];
  19. $url = explode('/', $url);
  20.  
  21. if(file_exists('tpl/'.$url[0].'.php')){
  22. require_once('tpl/'.$url[0].'.php');
  23. }
  24. else if(file_exists('tpl/'.$url[0].'/'.$url[1].'.php')){
  25. require_once('tpl/'.$url[0].'/'.$url[1].'.php');
  26. }
  27. else {
  28. require_once('tpl/404.php');
  29. }
  30. }
  31. else {
  32. require_once('tpl/'.$url.'.php'); // index.php
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement