xaviermontenegro

Untitled

Jul 16th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $page_set = false;
  4. if(isset($_GET['page'])) {
  5.     $page = $_GET['page'];
  6.     page_set = true;
  7. }
  8.  
  9. $gallery_set = false;
  10. if(isset($_GET['gallery'])) {
  11.     $gallery = $_GET['gallery'];
  12.     $gallery_set = true;
  13. }
  14.  
  15. include("header.php");
  16.  
  17. if($page_set) {
  18.     switch($page) {
  19.         case "gallery":
  20.             $gallery_path = "/path/to/galleries/{$gallery}.php";
  21.             if($gallery_set && file_exists($gallery_path)) {
  22.                 include($gallery_path);
  23.             } else {
  24.                 // include default gallery here
  25.             }
  26.         break;
  27.         default:
  28.             $page_path = "/path/to/pages/{$page}.php";
  29.             if(file_exists($page_set)) {
  30.                 include($page_path);
  31.             } else {
  32.                 // include home content here
  33.             }
  34.         break;
  35.     }
  36. } else {
  37.     // include home content here
  38. }
  39.  
  40. include("footer.php");
  41.  
  42. ?>
Add Comment
Please, Sign In to add comment