35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
|
<?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";
|
||
|
if (!file_exists($cesta_k_skriptu)){
|
||
|
$cesta_k_skriptu = '';
|
||
|
}
|
||
|
$out = str_replace('__TEMPLATE_SCRIPT__', "<script src=\"$cesta_k_skriptu\"></script>", $out);
|
||
|
|
||
|
$cesta_k_stylu = "styly/$nazov_stranky.css";
|
||
|
if (!file_exists($cesta_k_stylu)){
|
||
|
$cesta_k_stylu = '';
|
||
|
}
|
||
|
$out = str_replace('__TEMPLATE_STYLE__', "<link rel=\"style\" href=\"$cesta_k_stylu\">", $out);
|
||
|
|
||
|
echo $out;
|
||
|
?>
|