GameHub/index.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2024-04-21 12:48:12 +02:00
<?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";
2024-04-21 14:42:20 +02:00
$script_obsah = "<script src=\"$cesta_k_skriptu\"></script>";
2024-04-21 12:48:12 +02:00
if (!file_exists($cesta_k_skriptu)){
2024-04-21 14:42:20 +02:00
$script_obsah = '';
2024-04-21 12:48:12 +02:00
}
2024-04-21 14:42:20 +02:00
$out = str_replace('__TEMPLATE_SCRIPT__', $script_obsah, $out);
2024-04-21 12:48:12 +02:00
$cesta_k_stylu = "styly/$nazov_stranky.css";
2024-04-21 14:42:20 +02:00
$style_obsah = "<link rel=\"stylesheet\" href=\"$cesta_k_stylu\">";
2024-04-21 12:48:12 +02:00
if (!file_exists($cesta_k_stylu)){
2024-04-21 14:42:20 +02:00
$style_obsah = '';
2024-04-21 12:48:12 +02:00
}
2024-04-21 14:42:20 +02:00
$out = str_replace('__TEMPLATE_STYLE__', $style_obsah, $out);
2024-04-21 12:48:12 +02:00
echo $out;
?>