[READ-ONLY] Mirror of https://github.com/probablykasper/website-template. My PHP website template
1.4 kB
49 lines
1<?
2 include("includes/functions.php");
3 $slug = get_slug();
4 $skip_document = $thatsa404 = false;
5 // db_connect();
6
7 function slug_to_path($slug) {
8 if ($slug == "/") {
9 return "pages/home.php";
10 } elseif (file_exists("pages$slug/index.php")) {
11 return "pages$slug/index.php";
12 } elseif (file_exists("pages$slug.php")) {
13 return "pages$slug.php";
14 } else {
15 global $thatsa404;
16 $thatsa404 = true;
17 return "pages/404.php";
18 }
19 }
20 $include_path = slug_to_path($slug);
21
22 if (!$skip_document) {
23 session_start();
24?>
25<!DOCTYPE html>
26<html>
27 <head>
28 <meta charset="utf-8">
29 <meta name="theme-color" content="#db5945">
30 <title><?= ($thatsa404) ? "404 Title" : get_title($slug)?></title>
31 <!--Roboto--> <link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
32 <!--Favicon: http://realfavicongenerator.net -->
33 <link rel="stylesheet" type="text/css" href="/css/global.css?r=<?=rand(0,999)?>">
34 <?= get_css($slug); ?>
35 </head>
36
37 <body>
38 <section id="body" class="body">
39 <? include("$include_path"); ?>
40 </section>
41 <!--jQuery--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
42 <!--js.cookie--> <script src="/js/js.cookie-2.1.4.min.js"></script>
43 <!--rangeSlider--> <script src="/js/rangeSlider-0.3.11.min.js"></script>
44 </body>
45</html>
46<?
47 }
48 // db_disconnect();
49?>