Deploy from Lumerel
This commit is contained in:
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.git
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
20
.htaccess
Normal file
20
.htaccess
Normal file
@@ -0,0 +1,20 @@
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
# Redirect all requests to index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php [L]
|
||||
|
||||
# Prevent directory listing
|
||||
Options -Indexes
|
||||
|
||||
# Secure config and includes
|
||||
<Files "assets/config.php">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</Files>
|
||||
<Files "includes">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</Files>
|
||||
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM webdevops/php-nginx:8.3-alpine
|
||||
ENV WEB_DOCUMENT_ROOT=/app
|
||||
ARG CACHE_BUST=1771110052
|
||||
COPY . /app
|
||||
RUN echo "index index.php index.html index.htm;" > /opt/docker/etc/nginx/vhost.common.d/01-index.conf \
|
||||
&& echo "add_header Cache-Control 'no-cache, no-store, must-revalidate';" > /opt/docker/etc/nginx/vhost.common.d/02-no-cache.conf \
|
||||
&& chown -R application:application /app
|
||||
116
README.md
Normal file
116
README.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# Simple Framework
|
||||
|
||||
A lightweight PHP framework with clean routing and template management.
|
||||
|
||||
## Features
|
||||
|
||||
- **Simple Routing**: Clean URLs through `index.php` (e.g., `/index.php/about`)
|
||||
- **Template System**: Organized template files with reusable header/footer
|
||||
- **Output Buffering**: Templates can set variables that are used in header/footer
|
||||
- **Configuration Management**: Centralized constants in `assets/config.php`
|
||||
- **No Dependencies**: Pure PHP, no external libraries required
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
/
|
||||
âââ assets/
|
||||
â âââ config.php # Site configuration and constants
|
||||
â âââ css/
|
||||
â â âââ style.css # Main stylesheet
|
||||
â âââ js/
|
||||
â âââ main.js # Main JavaScript
|
||||
âââ includes/
|
||||
â âââ header.php # Site header
|
||||
â âââ footer.php # Site footer
|
||||
âââ templates/
|
||||
â âââ home.php # Home page template
|
||||
â âââ about.php # About page template
|
||||
â âââ contact.php # Contact page template
|
||||
âââ index.php # Bootstrap/Router
|
||||
âââ README.md
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **index.php** receives all requests and parses the URL
|
||||
2. It determines which template to load from `PAGE_TEMPLATES` in config
|
||||
3. The template file is loaded with `ob_start()` to buffer output
|
||||
4. Templates can set variables like `$pageTitle`, `$pageDescription`, `$additionalHead`, etc.
|
||||
5. The header is rendered (with access to template variables)
|
||||
6. The buffered template content is output
|
||||
7. The footer is rendered
|
||||
|
||||
## Configuration
|
||||
|
||||
Edit `assets/config.php` to customize:
|
||||
|
||||
- `SITE_NAME` - Your site name
|
||||
- `SITE_URL` - Your site URL
|
||||
- `PAGE_TEMPLATES` - Add/remove pages and their settings
|
||||
|
||||
## Adding New Pages
|
||||
|
||||
1. Add a new entry to `PAGE_TEMPLATES` in `assets/config.php`:
|
||||
|
||||
```php
|
||||
'services' => [
|
||||
'file' => 'services.php',
|
||||
'title' => 'Services'
|
||||
]
|
||||
```
|
||||
|
||||
2. Create the template file in `templates/services.php`
|
||||
3. The page will automatically appear in the navigation
|
||||
|
||||
## Template Variables
|
||||
|
||||
Templates can set these variables to customize the output:
|
||||
|
||||
- `$pageTitle` - Page title (appears in `<title>` tag)
|
||||
- `$pageDescription` - Meta description
|
||||
- `$bodyClass` - CSS class for `<body>` tag
|
||||
- `$additionalHead` - Extra HTML for `<head>` section
|
||||
- `$footerExtra` - Extra content in the footer
|
||||
|
||||
## Example Template
|
||||
|
||||
```php
|
||||
<?php
|
||||
$pageTitle = 'My Page';
|
||||
$pageDescription = 'This is my page description';
|
||||
$bodyClass = 'my-custom-class';
|
||||
?>
|
||||
|
||||
<section>
|
||||
<h1>My Page Content</h1>
|
||||
<p>This content will be wrapped by header and footer.</p>
|
||||
</section>
|
||||
```
|
||||
|
||||
## Server Configuration
|
||||
|
||||
### Apache
|
||||
|
||||
Enable mod_rewrite and use this `.htaccess` for cleaner URLs (optional):
|
||||
|
||||
```apache
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]
|
||||
```
|
||||
|
||||
### PHP Built-in Server
|
||||
|
||||
For development:
|
||||
|
||||
```bash
|
||||
php -S localhost:8000
|
||||
```
|
||||
|
||||
Then visit: `http://localhost:8000/index.php/about`
|
||||
|
||||
## License
|
||||
|
||||
Free to use for any purpose.
|
||||
137
assets/css/style.css
Normal file
137
assets/css/style.css
Normal file
@@ -0,0 +1,137 @@
|
||||
/* Reset and Base Styles */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
line-height: 1.6;
|
||||
background-color: #f4f6f9;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* Header Styles */
|
||||
.site-header {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.header-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.logo a {
|
||||
font-size: 1.8rem;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.main-nav ul {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.main-nav ul li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.main-nav ul li a {
|
||||
text-decoration: none;
|
||||
color: #34495e;
|
||||
font-weight: 500;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.main-nav ul li a:hover {
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
/* Container Styles */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem 15px;
|
||||
}
|
||||
|
||||
/* Home Page Styles */
|
||||
.home-columns {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.home-column {
|
||||
background-color: white;
|
||||
border-radius: 15px;
|
||||
padding: 30px;
|
||||
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Contact Form Styles */
|
||||
.contact-form {
|
||||
background-color: white;
|
||||
border-radius: 15px;
|
||||
padding: 30px;
|
||||
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.contact-form input,
|
||||
.contact-form textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
.contact-form input:focus,
|
||||
.contact-form textarea:focus {
|
||||
outline: none;
|
||||
border-color: #3498db;
|
||||
}
|
||||
|
||||
.contact-form button {
|
||||
background-color: #3498db;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 25px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.contact-form button:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
/* Responsive Adjustments */
|
||||
@media (max-width: 768px) {
|
||||
.header-container {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main-nav ul {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main-nav ul li {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.home-columns {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
27
assets/js/main.js
Normal file
27
assets/js/main.js
Normal file
@@ -0,0 +1,27 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Smooth scroll for internal links
|
||||
document.querySelectorAll('a[href^="/"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const targetPath = this.getAttribute('href');
|
||||
|
||||
// Optional: Add a subtle fade out/in transition
|
||||
document.body.style.opacity = '0';
|
||||
setTimeout(() => {
|
||||
window.location.href = targetPath;
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
|
||||
// Optional: Add hover effects or other interactive elements
|
||||
const buttons = document.querySelectorAll('.btn');
|
||||
buttons.forEach(btn => {
|
||||
btn.addEventListener('mouseenter', function() {
|
||||
this.style.transform = 'scale(1.05)';
|
||||
});
|
||||
btn.addEventListener('mouseleave', function() {
|
||||
this.style.transform = 'scale(1)';
|
||||
});
|
||||
});
|
||||
});
|
||||
5
config/config.php
Normal file
5
config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class SiteConfig {
|
||||
const SITE_NAME = 'Simple Framework';
|
||||
const SITE_URL = 'https://simple-framework-klby21.lumerel.app';
|
||||
}
|
||||
7
includes/footer.php
Normal file
7
includes/footer.php
Normal file
@@ -0,0 +1,7 @@
|
||||
</main>
|
||||
<footer>
|
||||
<p>© <?= date('Y') ?> <?= SiteConfig::SITE_NAME ?>. All rights reserved.</p>
|
||||
</footer>
|
||||
<script src="/assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
19
includes/header.php
Normal file
19
includes/header.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo $pageTitle; ?></title>
|
||||
<link rel="stylesheet" href="/assets/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about">About</a></li>
|
||||
<li><a href="/contact">Contact</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
10
index.php
Normal file
10
index.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$page = $_GET['page'] ?? 'home';
|
||||
|
||||
$allowed_pages = ['home', 'about', 'contact'];
|
||||
$page = in_array($page, $allowed_pages) ? $page : 'home';
|
||||
|
||||
include 'includes/header.php';
|
||||
include "templates/{$page}.php";
|
||||
include 'includes/footer.php';
|
||||
?>
|
||||
13
templates/about.php
Normal file
13
templates/about.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$pageTitle = 'About Us';
|
||||
$pageDescription = 'Learn more about our Simple Framework';
|
||||
?>
|
||||
<h1>About</h1>
|
||||
<p>This is a lightweight PHP framework designed for simplicity and ease of use.</p>
|
||||
<p>Key features:</p>
|
||||
<ul>
|
||||
<li>Simple routing</li>
|
||||
<li>Dynamic page templates</li>
|
||||
<li>Minimal configuration</li>
|
||||
<li>Clean, readable code</li>
|
||||
</ul>
|
||||
18
templates/contact.php
Normal file
18
templates/contact.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php include 'includes/header.php'; ?>
|
||||
|
||||
<div class="container">
|
||||
<div class="contact-form">
|
||||
<h2>Get in Touch</h2>
|
||||
<p>Have a project in mind? Let's discuss how we can bring your vision to life.</p>
|
||||
|
||||
<form action="#" method="post">
|
||||
<input type="text" name="name" placeholder="Your Name" required>
|
||||
<input type="email" name="email" placeholder="Your Email" required>
|
||||
<input type="tel" name="phone" placeholder="Your Phone Number">
|
||||
<textarea name="message" rows="5" placeholder="Tell us about your project" required></textarea>
|
||||
<button type="submit">Send Message</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
34
templates/error.php
Normal file
34
templates/error.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Error | Simple Framework</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.error-container {
|
||||
background-color: white;
|
||||
padding: 2rem;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
||||
max-width: 500px;
|
||||
}
|
||||
h1 { color: #d9534f; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<h1>Oops! Something went wrong</h1>
|
||||
<p>We're sorry, but an unexpected error occurred. Our team has been notified.</p>
|
||||
<p><a href="/">Return to Home</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
27
templates/home.php
Normal file
27
templates/home.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php include 'includes/header.php'; ?>
|
||||
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>Welcome to Todd Low Media</h1>
|
||||
<p>Innovative Solutions for Modern Challenges</p>
|
||||
</header>
|
||||
|
||||
<div class="content-grid">
|
||||
<div class="content-card">
|
||||
<h2>Creative Strategy</h2>
|
||||
<p>We transform complex ideas into elegant, actionable strategies that drive meaningful results and push boundaries of innovation.</p>
|
||||
</div>
|
||||
|
||||
<div class="content-card">
|
||||
<h2>Technology Solutions</h2>
|
||||
<p>Leveraging cutting-edge technologies to build scalable, efficient digital solutions that adapt and evolve with your business needs.</p>
|
||||
</div>
|
||||
|
||||
<div class="content-card">
|
||||
<h2>Digital Transformation</h2>
|
||||
<p>Our holistic approach merges design, technology, and strategic thinking to reimagine how businesses operate in the digital landscape.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user