Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $galleries_base_dir = "/path/to/galleries";
- $default_gallery = "default_gallery";
- $pages_base_dir = "/path/to/pages";
- $default_page = "home";
- if(isset($_GET['page'])) {
- $page = $_GET['page'];
- } else {
- $page = $default_page;
- }
- include("header.php");
- switch($page) {
- case "gallery":
- if(isset($_GET['gallery'])) {
- $gallery = $_GET['gallery'];
- } else {
- $gallery = $default_gallery;
- }
- $gallery_path = "{$galleries_base_dir}/{$gallery}.php";
- include(get_page_to_load($gallery_path, "{$galleries_base_dir}/{$default_gallery}.php");
- break;
- default:
- $page_path = "{$pages_base_dir}/{$page}.php";
- include(get_page_to_load($page_path, "{$pages_base_dir}/{$default_page}.php"));
- break;
- }
- include("footer.php");
- function get_page_to_load($attempted_page, $default_page) {
- if($attempted_page != $default_page && file_exists($attempted_page)) {
- return $attempted_page;
- } else {
- return $default_page;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment