got help from BRN_systems

This commit is contained in:
Dávid Jančár 2024-05-14 16:30:25 +02:00
commit 975e824363
9 changed files with 73 additions and 0 deletions

0
global/global.css Normal file

0
global/global.js Normal file

37
index.php Normal file

@ -0,0 +1,37 @@
<?php
$skeleton = file_get_contents('templates/skeleton.html');
$menu_obsah = file_get_contents('templates/header.html');
$out = str_replace('__TEMPLATE_HEADER__', $menu_obsah, $skeleton);
$footer_obsah = file_get_contents('templates/footer.html');
$out = str_replace('__TEMPLATE_FOOTER__', $footer_obsah, $out);
$nazov_stranky = basename($_SERVER['QUERY_STRING']);
if (empty($nazov_stranky)){
$nazov_stranky = 'index';
}
$cesta_k_stranke = "stranky/$nazov_stranky.html";
if (!file_exists($cesta_k_stranke)) {
$cesta_k_stranke = "templates/404.html";
}
$stranka_obsah = file_get_contents($cesta_k_stranke);
$out = str_replace('__TEMPLATE_STRANKA__', $stranka_obsah, $out);
$cesta_k_skriptu = "scripty/$nazov_stranky.js";
$script_obsah = "<script src=\"$cesta_k_skriptu\"></script>";
if (!file_exists($cesta_k_skriptu)){
$script_obsah = '';
}
$out = str_replace('__TEMPLATE_SCRIPT__', $script_obsah, $out);
$cesta_k_stylu = "styles/$nazov_stranky.css";
$style_obsah = "<link rel=\"stylesheet\" href=\"$cesta_k_stylu\">";
if (!file_exists($cesta_k_stylu)){
$style_obsah = '';
}
$out = str_replace('__TEMPLATE_STYLE__', $style_obsah, $out);
echo $out;
?>

1
stranky/index.html Normal file

@ -0,0 +1 @@
<p>jello</p>

1
stranky/test.html Normal file

@ -0,0 +1 @@
<p>jello_test</p>

1
templates/404.html Normal file

@ -0,0 +1 @@
<h1>JOŽO ČO TU ROBÍŠ</h1>

1
templates/footer.html Normal file

@ -0,0 +1 @@
<h1>pata</h1>

1
templates/header.html Normal file

@ -0,0 +1 @@
<h1>hlava</h1>

31
templates/skeleton.html Normal file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"
integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A=="
crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="/global/global.css">
<script src="/global/global.js"></script>
<title>GAME HUB</title>
__TEMPLATE_SCRIPT__
__TEMPLATE_STYLE__
</head>
<body>
<header>
__TEMPLATE_HEADER__
</header>
<main>
__TEMPLATE_STRANKA__
</main>
<footer>
__TEMPLATE_FOOTER__
</footer>
</body>
</html>