SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | - | $page_set = false; |
3 | + | $galleries_base_dir = "/path/to/galleries"; |
4 | $default_gallery = "default_gallery"; | |
5 | $pages_base_dir = "/path/to/pages"; | |
6 | - | page_set = true; |
6 | + | $default_page = "home"; |
7 | ||
8 | if(isset($_GET['page'])) { | |
9 | - | $gallery_set = false; |
9 | + | |
10 | } else { | |
11 | $page = $default_page; | |
12 | - | $gallery_set = true; |
12 | + | |
13 | ||
14 | if(isset($_GET['gallery'])) { | |
15 | $gallery = $_GET['gallery']; | |
16 | } else { | |
17 | - | if($page_set) { |
17 | + | $gallery = $default_gallery; |
18 | - | switch($page) { |
18 | + | |
19 | - | case "gallery": |
19 | + | |
20 | - | $gallery_path = "/path/to/galleries/{$gallery}.php"; |
20 | + | |
21 | - | if($gallery_set && file_exists($gallery_path)) { |
21 | + | |
22 | - | include($gallery_path); |
22 | + | switch($page) { |
23 | - | } else { |
23 | + | case "gallery": |
24 | - | // include default gallery here |
24 | + | $gallery_path = "{$galleries_base_dir}/{$gallery}.php"; |
25 | - | } |
25 | + | if(file_exists($gallery_path)) { |
26 | - | break; |
26 | + | include($gallery_path); |
27 | - | default: |
27 | + | } else { |
28 | - | $page_path = "/path/to/pages/{$page}.php"; |
28 | + | include("{$galleries_base_dir}/{$default_gallery}.php"); |
29 | - | if(file_exists($page_set)) { |
29 | + | } |
30 | - | include($page_path); |
30 | + | break; |
31 | - | } else { |
31 | + | default: |
32 | - | // include home content here |
32 | + | $page_path = "{$pages_base_dir}/{$page}.php"; |
33 | - | } |
33 | + | if(file_exists($page_set)) { |
34 | - | break; |
34 | + | include($page_path); |
35 | - | } |
35 | + | } else { |
36 | include("{$pages_base_dir}/{$default_page}.php"); | |
37 | - | // include home content here |
37 | + | } |
38 | break; | |
39 | } | |
40 | ||
41 | ||
42 | include("footer.php"); | |
43 | ||
44 | ?> |