-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (32 loc) · 933 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
header("Access-Control-Allow-Origin: https://apod.nasa.gov/*");
include "./src/php/make_page.php";
$noPageRequest = true; // true if there is no 'page' tag in the GET request.
if(isset($_GET['lang'])){
$lang=$_GET['lang'];
}
else{
$lang="en";
}
if(isset($_GET['page'])){
$page=$_GET['page'];
$noPageRequest = false;
}
else{
$page = "home";
}
if($noPageRequest){
$tmpl = file_get_contents("./inc/page_tmpl.html");
$nav = file_get_contents("./inc/navigation.html");
$footer = file_get_contents("./inc/footer.html");
// $main = file_get_contents("./inc/home.html");
$tmpl = str_replace("#nav", $nav, $tmpl);
$tmpl = str_replace("#page", "Home", $tmpl);
$tmpl = str_replace("#footer", $footer, $tmpl);
$tmpl = str_replace("#main", makePage("home", "en"), $tmpl);
echo $tmpl;
}
else{
echo makePage($page);
}
?>