mirror of
https://codeberg.org/Kankys/eos-modern.git
synced 2026-05-01 00:19:49 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// eos-modern/includes/config.php
|
||||
|
||||
// Zjistíme cestu, kterou uživatel vidí v prohlížeči
|
||||
$requestUri = $_SERVER['REQUEST_URI']; // Např. /eos-modern/public/index.php
|
||||
$pathInfo = parse_url($requestUri, PHP_URL_PATH);
|
||||
|
||||
// Najdeme, kde končí název projektu a začíná 'public'
|
||||
// Hledáme 'public' v cestě
|
||||
$parts = explode('/', trim($pathInfo, '/'));
|
||||
$publicIndex = array_search('public', $parts);
|
||||
|
||||
if ($publicIndex !== false) {
|
||||
// Pokud jsme v podsložce, WEB_ROOT bude cesta do 'public'
|
||||
// Např. /eos-modern/public
|
||||
$webRootParts = array_slice($parts, 0, $publicIndex + 1);
|
||||
define('WEB_ROOT', '/' . implode('/', $webRootParts));
|
||||
} else {
|
||||
// Pokud jsme v kořeni
|
||||
define('WEB_ROOT', '');
|
||||
}
|
||||
|
||||
// Definice cest k souborům (relativně k config.php)
|
||||
// config.php je v: /home/user/eos-modern/includes/
|
||||
// content je v: /home/user/eos-modern/content/
|
||||
define('PATH_TEMPLATES', __DIR__ . '/../templates/');
|
||||
define('PATH_CONTENT', __DIR__ . '/../content/');
|
||||
|
||||
// Cesty k veřejným souborům (pro HTML odkazy)
|
||||
// Ty musí obsahovat WEB_ROOT
|
||||
define('PATH_CSS', WEB_ROOT . '/assets/css/style.css');
|
||||
define('PATH_JS', WEB_ROOT . '/assets/js/main.js');
|
||||
define('PATH_DATA', WEB_ROOT . '/data/articles.json');
|
||||
Reference in New Issue
Block a user