From f146db4aedcc9efa00ffa82c5fa204b6d1709a8d Mon Sep 17 00:00:00 2001
From: sld-admin
Date: Wed, 19 Aug 2026 17:56:28 +0100
Subject: [PATCH] Ripristino template originale
---
.htaccess | 6 ++
LICENSE | 18 +++++
README.md | 163 ++++++++++++++++++++++++++++++++++++++
assets/css/animations.css | 20 +++++
assets/css/style.css | 18 +++++
assets/css/variables.css | 86 ++++++++++++++++++++
assets/js/main.js | 9 +++
config/constants.php | 78 ++++++++++++++++++
config/db.php | 21 +++++
config/functions_init.php | 134 +++++++++++++++++++++++++++++++
config/init.php | 27 +++++++
config/settings.php | 39 +++++++++
functions/functions.php | 25 ++++++
includes/head_links.php | 7 ++
includes/js_footer.php | 3 +
index.php | 7 ++
pages/404.php | 4 +
pages/about.php | 1 +
pages/db-error.php | 77 ++++++++++++++++++
pages/env-error.php | 55 +++++++++++++
pages/home.php | 6 ++
templates/footer.php | 9 +++
templates/header.php | 20 +++++
23 files changed, 833 insertions(+)
create mode 100644 .htaccess
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 assets/css/animations.css
create mode 100644 assets/css/style.css
create mode 100644 assets/css/variables.css
create mode 100644 assets/js/main.js
create mode 100644 config/constants.php
create mode 100644 config/db.php
create mode 100644 config/functions_init.php
create mode 100644 config/init.php
create mode 100644 config/settings.php
create mode 100644 functions/functions.php
create mode 100644 includes/head_links.php
create mode 100644 includes/js_footer.php
create mode 100644 index.php
create mode 100644 pages/404.php
create mode 100644 pages/about.php
create mode 100644 pages/db-error.php
create mode 100644 pages/env-error.php
create mode 100644 pages/home.php
create mode 100644 templates/footer.php
create mode 100644 templates/header.php
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..05f1d9f
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,6 @@
+RewriteEngine On
+
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+
+RewriteRule ^([a-zA-Z0-9-]+)/?$ index.php?page=$1 [QSA,L]
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4347a1d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,18 @@
+MIT License
+
+Copyright (c) 2026 sld-admin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
+EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e868a24
--- /dev/null
+++ b/README.md
@@ -0,0 +1,163 @@
+# SLD PHP Template
+
+A lightweight and modular PHP starter framework for building plain PHP websites without heavy dependencies.
+
+This project is designed to provide a clean structure, reusable components, and a simple initialization system to speed up development while keeping full control over the codebase.
+
+---
+
+## π Features
+
+- β‘ Lightweight and fast (no external frameworks required)
+- π Clean and scalable folder structure
+- π§ Centralized configuration system
+- π§© Modular templates (header, footer, includes)
+- π¨ Basic frontend setup (CSS variables, animations, JS helpers)
+- π Ready-to-use initialization system
+- β Built-in error pages (environment & database)
+
+---
+
+## π Project Structure
+
+```
+.
+βββ admin/
+βββ assets/
+β βββ css/
+β βββ img/
+β βββ js/
+βββ config/
+βββ functions/
+βββ includes/
+βββ pages/
+βββ templates/
+βββ themes/
+βββ public/
+βββ index.php
+βββ README.md
+```
+
+---
+
+## βοΈ Configuration
+
+All core configuration is located inside the `config/` directory:
+
+- `init.php` β Application bootstrap
+- `constants.php` β Global constants
+- `settings.php` β App settings
+- `db.php` β Database connection
+- `functions_init.php` β Function loader
+
+---
+
+## π§ How It Works
+
+1. The application starts from `index.php`
+2. Core initialization is handled by the config system
+3. Templates are loaded dynamically (`header.php`, `footer.php`)
+4. Pages are rendered from the `pages/` directory
+5. Custom logic can be added via the `functions/` folder
+
+---
+
+## π¨ Frontend
+
+The project includes a minimal frontend setup:
+
+### CSS System
+- Variables-based color system with multiple shades
+- Basic layout styles
+- Animation utilities
+
+### JavaScript
+- Simple helper functions like dynamic year rendering
+
+---
+
+## π Usage
+
+1. Clone the repository:
+ ```bash
+ git clone https://github.com/your-username/sld-php-template.git
+ ```
+
+2. Move it into your web server directory
+
+3. Configure:
+ - Database (`config/db.php`)
+ - Environment settings (`config/settings.php`)
+
+4. Open in browser:
+ ```
+ http://localhost/your-project
+ ```
+
+---
+
+## π Pages
+
+- `home.php` β Main homepage
+- `db-error.php` β Database error page
+- `env-error.php` β Environment error page
+
+---
+
+## π§© Templates
+
+Reusable layout components:
+
+- `templates/header.php`
+- `templates/footer.php`
+
+---
+
+## π§ͺ Status
+
+π§ This project is currently in development.
+New features and improvements will be added progressively.
+
+---
+
+## π Roadmap (Planned)
+
+- [ ] Routing system
+- [ ] Theme engine
+- [ ] Admin panel structure
+- [ ] CLI tools
+- [ ] Environment (.env) support
+- [ ] Basic authentication system
+
+---
+
+## π€ Contributing
+
+Contributions, ideas, and feedback are welcome.
+Feel free to open issues or pull requests.
+
+---
+
+## π License
+
+This project is licensed under the MIT License.
+See the `LICENSE` file for details.
+
+---
+
+## π€ Author
+
+Created by Simone (SLD)
+
+---
+
+## π‘ Philosophy
+
+This project aims to stay:
+
+- Simple
+- Transparent
+- Framework-free
+- Easy to extend
+
+No magic, just clean PHP.
\ No newline at end of file
diff --git a/assets/css/animations.css b/assets/css/animations.css
new file mode 100644
index 0000000..b29e099
--- /dev/null
+++ b/assets/css/animations.css
@@ -0,0 +1,20 @@
+@keyframes example {
+ 0% {background-color: red;}
+ 25% {background-color: yellow;}
+ 50% {background-color: blue;}
+ 100% {background-color: green;}
+}
+
+/* ### EXAMPLE SETTING CODE ###
+ animation-name: example;
+ animation-duration: 4s;
+ animation-iteration-count: 2;
+ animation-direction: alternate-reverse;
+ animation-delay: -2s;
+ animation-fill-mode: forwards;
+ animation-timing-function: ease-in-out;}
+
+ ### SAME ABOVE ANIMATION IN ONE LINE CODE ###
+ animation: example 5s linear 2s infinite alternate;
+*/
+
diff --git a/assets/css/style.css b/assets/css/style.css
new file mode 100644
index 0000000..2a4c2a7
--- /dev/null
+++ b/assets/css/style.css
@@ -0,0 +1,18 @@
+html { scroll-behavior: smooth; }
+*{ box-sizing: border-box; margin:0; padding:0;}
+
+
+.main-nav{
+ display:flex;
+ width:100%;
+ gap: 1rem;
+ align-items: center;
+ justify-content: flex-start;
+ list-style-type: none;
+ padding:1rem;
+}
+
+.main-nav a {
+ text-decoration: none;
+}
+
diff --git a/assets/css/variables.css b/assets/css/variables.css
new file mode 100644
index 0000000..37fe40e
--- /dev/null
+++ b/assets/css/variables.css
@@ -0,0 +1,86 @@
+:root {
+ /*### PrimaryColor ###*/
+ --demo1:hsl(98, 100%, 50%);/*Use this only to check the color (--pri) if is fine*/
+ --pri:98; /*Change only this from the color that you need! Don't Touch the code below!*/
+ /*The color below is automaticaly created 20 levels of lightness*/
+ --priCol20:hsl(var(--pri), 100%, 100%);
+ --priCol19:hsl(var(--pri), 100%, 95%);
+ --priCol18:hsl(var(--pri), 100%, 90%);
+ --priCol17:hsl(var(--pri), 100%, 85%);
+ --priCol16:hsl(var(--pri), 100%, 80%);
+ --priCol15:hsl(var(--pri), 100%, 75%);
+ --priCol14:hsl(var(--pri), 100%, 70%);
+ --priCol13:hsl(var(--pri), 100%, 65%);
+ --priCol12:hsl(var(--pri), 100%, 60%);
+ --priCol11:hsl(var(--pri), 100%, 55%);
+ --priCol10:hsl(var(--pri), 100%, 50%);
+ --priCol9:hsl(var(--pri), 100%, 45%);
+ --priCol8:hsl(var(--pri), 100%, 40%);
+ --priCol7:hsl(var(--pri), 100%, 35%);
+ --priCol6:hsl(var(--pri), 100%, 30%);
+ --priCol5:hsl(var(--pri), 100%, 25%);
+ --priCol4:hsl(var(--pri), 100%, 20%);
+ --priCol3:hsl(var(--pri), 100%, 15%);
+ --priCol2:hsl(var(--pri), 100%, 10%);
+ --priCol1:hsl(var(--pri), 100%, 5%);
+
+ /*### SecondColor ###*/
+ --demo2:hsl(207, 100%, 50%);/*Use this only to check the color (--pri) if is fine*/
+ --sec:207; /*Change only this from the color that you need! Don't Touch the code below!*/
+ /*The color below is automaticaly created 20 levels of lightness*/
+ --secCol20:hsl(var(--sec), 100%, 100%);
+ --secCol19:hsl(var(--sec), 100%, 95%);
+ --secCol18:hsl(var(--sec), 100%, 90%);
+ --secCol17:hsl(var(--sec), 100%, 85%);
+ --secCol16:hsl(var(--sec), 100%, 80%);
+ --secCol15:hsl(var(--sec), 100%, 75%);
+ --secCol14:hsl(var(--sec), 100%, 70%);
+ --secCol13:hsl(var(--sec), 100%, 65%);
+ --secCol12:hsl(var(--sec), 100%, 60%);
+ --secCol11:hsl(var(--sec), 100%, 55%);
+ --secCol10:hsl(var(--sec), 100%, 50%);
+ --secCol9:hsl(var(--sec), 100%, 45%);
+ --secCol8:hsl(var(--sec), 100%, 40%);
+ --secCol7:hsl(var(--sec), 100%, 35%);
+ --secCol6:hsl(var(--sec), 100%, 30%);
+ --secCol5:hsl(var(--sec), 100%, 25%);
+ --secCol4:hsl(var(--sec), 100%, 20%);
+ --secCol3:hsl(var(--sec), 100%, 15%);
+ --secCol2:hsl(var(--sec), 100%, 10%);
+ --secCol1:hsl(var(--sec), 100%, 5%);
+
+ /*### ThirdColor ###*/
+ --demo3:hsl(280, 100%, 50%);/*Use this only to check the color (--pri) if is fine*/
+ --thi:280; /*Change only this from the color that you need! Don't Touch the code below!*/
+ /*The color below is automaticaly created 20 levels of lightness*/
+ --thiCol20:hsl(var(--thi), 100%, 100%);
+ --thiCol19:hsl(var(--thi), 100%, 95%);
+ --thiCol18:hsl(var(--thi), 100%, 90%);
+ --thiCol17:hsl(var(--thi), 100%, 85%);
+ --thiCol16:hsl(var(--thi), 100%, 80%);
+ --thiCol15:hsl(var(--thi), 100%, 75%);
+ --thiCol14:hsl(var(--thi), 100%, 70%);
+ --thiCol13:hsl(var(--thi), 100%, 65%);
+ --thiCol12:hsl(var(--thi), 100%, 60%);
+ --thiCol11:hsl(var(--thi), 100%, 55%);
+ --thiCol10:hsl(var(--thi), 100%, 50%);
+ --thiCol9:hsl(var(--thi), 100%, 45%);
+ --thiCol8:hsl(var(--thi), 100%, 40%);
+ --thiCol7:hsl(var(--thi), 100%, 35%);
+ --thiCol6:hsl(var(--thi), 100%, 30%);
+ --thiCol5:hsl(var(--thi), 100%, 25%);
+ --thiCol4:hsl(var(--thi), 100%, 20%);
+ --thiCol3:hsl(var(--thi), 100%, 15%);
+ --thiCol2:hsl(var(--thi), 100%, 10%);
+ --thiCol1:hsl(var(--thi), 100%, 5%);
+
+ /*######################################*/
+
+ /*##### Default Variable #####*/
+ --padsidepage:0 25px; /*Padding side for page*/
+}
+
+/* ### Use Example ###
+background-color:var(--main-bg-color)
+*/
+
diff --git a/assets/js/main.js b/assets/js/main.js
new file mode 100644
index 0000000..5f8d470
--- /dev/null
+++ b/assets/js/main.js
@@ -0,0 +1,9 @@
+/* @ default js*/
+function yearNow(textlocation) {
+ //This is a function to substitutes a value into the current year.
+ //Usually good for the footer.
+ var data = new Date();
+ var year;
+ year = data.getFullYear();
+ document.querySelector(textlocation).replaceWith(year);
+}
\ No newline at end of file
diff --git a/config/constants.php b/config/constants.php
new file mode 100644
index 0000000..bc09841
--- /dev/null
+++ b/config/constants.php
@@ -0,0 +1,78 @@
+
\ No newline at end of file
diff --git a/config/db.php b/config/db.php
new file mode 100644
index 0000000..219ad75
--- /dev/null
+++ b/config/db.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/config/functions_init.php b/config/functions_init.php
new file mode 100644
index 0000000..3b0a610
--- /dev/null
+++ b/config/functions_init.php
@@ -0,0 +1,134 @@
+ERROR: Variable '\$env ' is empty!
";
+ $help = "Please insert the correct value in the file 'config/init.php' or leave it to 'generic'
";
+ } else {
+ $result = "ERROR: The environment '{$env} ' does not exist!
";
+ $help = "Please insert the correct value in the file 'config/init.php' or leave it to 'generic'
";
+ }
+
+ echo $option === "result" ? $result : $help;
+}
+
+
+/**
+ * Get current page safely.
+ */
+function get_current_page() {
+ $page = $_GET["page"] ?? "home";
+
+ $page = strtolower(trim($page));
+ $page = preg_replace("/[^a-z0-9\-]/", "", $page);
+
+ if ($page === "") {
+ $page = "home";
+ }
+
+ return $page;
+}
+
+
+/**
+ * Resolve page file.
+ */
+function resolve_page() {
+ $page = get_current_page();
+ $file = PAGES_FOLD . $page . ".php";
+
+ // π rendi disponibile globalmente
+ $GLOBALS["current_page"] = $page;
+
+ if (file_exists($file)) {
+ return $file;
+ }
+
+ http_response_code(404);
+ $GLOBALS["current_page"] = "404";
+ return PAGES_FOLD . "404.php";
+}
+
+/**
+* DEBUG FUNCTIONS AND ARRAY
+*/
+
+$debug_messages = [
+ 'High' => [],
+ 'Medium' => [],
+ 'Low' => [],
+ 'Info' => []
+];
+
+// FUNCTION TO GET DEBUG STATUS MESSAGES
+function debugStatusMes( string $Message, string $intensity) {
+ global $debug, $debug_messages;
+
+ // Controlla se il debug Γ¨ attivo
+ if ($debug !== "on") {
+ return;
+ }
+
+ // Normalizza l'intensitΓ per evitare errori di battitura (es. "high" diventa "High")
+ $intensity = ucfirst(strtolower($intensity));
+
+ // Verifica che l'intensitΓ sia valida prima di inserire il messaggio
+ if (array_key_exists($intensity, $debug_messages)) {
+ $debug_messages[$intensity][] = $Message;
+ } else {
+ // Se l'intensitΓ non Γ¨ corretta, la salva in una categoria generica o Low
+ $debug_messages['Low'][] = "[IntensitΓ errata: $intensity] " . $Message;
+ }
+}
+
+// DISPLAY DEBUG ERROR BAR
+function displayDebug() {
+ global $debug, $debug_messages;
+
+ if ($debug !== "on") {
+ return;
+ }
+
+ // Contenitore temporaneo nascosto per non creare sfarfallii nella pagina
+ echo '';
+ echo '
';
+ echo '
βοΈ Debug Status Messages ';
+
+ foreach ($debug_messages as $level => $messages) {
+ if (!empty($messages)) {
+ $color = '#6cef93';
+ if ($level === 'High') $color = '#ff4444';
+ if ($level === 'Medium') $color = '#ffbb33';
+ if ($level === 'Info') $color = '#4444ff';
+
+ echo "
";
+ echo "
[" . $level . "] ";
+ echo "
";
+ foreach ($messages as $msg) {
+ echo "" . htmlspecialchars($msg) . " ";
+ }
+ echo " ";
+ echo "
";
+ }
+ }
+ echo '
';
+ echo '
';
+
+ // Questo script JS prende il contenuto appena generato e lo sposta nel segnaposto in cima
+ ?>
+
+
\ No newline at end of file
diff --git a/config/settings.php b/config/settings.php
new file mode 100644
index 0000000..5a4a6da
--- /dev/null
+++ b/config/settings.php
@@ -0,0 +1,39 @@
+
\ No newline at end of file
diff --git a/functions/functions.php b/functions/functions.php
new file mode 100644
index 0000000..d36fbca
--- /dev/null
+++ b/functions/functions.php
@@ -0,0 +1,25 @@
+">
+
+
+
+
+
+
diff --git a/includes/js_footer.php b/includes/js_footer.php
new file mode 100644
index 0000000..e335211
--- /dev/null
+++ b/includes/js_footer.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..acee08f
--- /dev/null
+++ b/index.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/pages/404.php b/pages/404.php
new file mode 100644
index 0000000..6e6d4e0
--- /dev/null
+++ b/pages/404.php
@@ -0,0 +1,4 @@
+
+ 404
+ Page not found.
+
\ No newline at end of file
diff --git a/pages/about.php b/pages/about.php
new file mode 100644
index 0000000..7d877fd
--- /dev/null
+++ b/pages/about.php
@@ -0,0 +1 @@
+About
\ No newline at end of file
diff --git a/pages/db-error.php b/pages/db-error.php
new file mode 100644
index 0000000..cb0a728
--- /dev/null
+++ b/pages/db-error.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ Error Environment
+
+
+
+
+
ERROR: Can't establish a db connection!
+
Please check the db.php configurations.
+
Error Details: " . $e->getMessage() . "";
+ }
+ debugStatusMes("Database connection failed.", "High");
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/env-error.php b/pages/env-error.php
new file mode 100644
index 0000000..02501ca
--- /dev/null
+++ b/pages/env-error.php
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+ Error Environment
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/home.php b/pages/home.php
new file mode 100644
index 0000000..b52add3
--- /dev/null
+++ b/pages/home.php
@@ -0,0 +1,6 @@
+
+
+ Welcome to the Home Page
+ This is the home page.
+
+
diff --git a/templates/footer.php b/templates/footer.php
new file mode 100644
index 0000000..926b647
--- /dev/null
+++ b/templates/footer.php
@@ -0,0 +1,9 @@
+
+
+
+
+