245 lines
12 KiB
PHP
245 lines
12 KiB
PHP
<?php
|
|
// CONFIG
|
|
$content_file = __DIR__ . '/db/content.json';
|
|
|
|
// Default content
|
|
$default_content = [
|
|
'hero_title' => 'Build Your Dream Website',
|
|
'hero_subtitle' => 'Visually design, customize, and publish beautiful, responsive websites. No code required.',
|
|
'features_title' => 'Powerful Features',
|
|
'features' => [
|
|
[
|
|
'icon' => 'bi-grid-1x2-fill',
|
|
'title' => 'Drag & Drop Builder',
|
|
'description' => 'Easily build and customize your site with our intuitive visual editor.'
|
|
],
|
|
[
|
|
'icon' => 'bi-palette-fill',
|
|
'title' => 'Beautiful Templates',
|
|
'description' => 'Choose from a variety of professionally designed templates to get started.'
|
|
],
|
|
[
|
|
'icon' => 'bi-phone-fill',
|
|
'title' => 'Fully Responsive',
|
|
'description' => 'Your website will look stunning on any device, from desktops to smartphones.'
|
|
]
|
|
],
|
|
'about_title' => 'About Us',
|
|
'about_text' => 'We are a passionate team dedicated to making web creation accessible to everyone. Our mission is to empower you to bring your ideas to life online, without needing to write a single line of code. Join us on this journey!'
|
|
];
|
|
|
|
// Load content from JSON file if it exists
|
|
if (file_exists($content_file)) {
|
|
$json_content = file_get_contents($content_file);
|
|
$content = json_decode($json_content, true);
|
|
// Merge with defaults to ensure all keys are present
|
|
$content = array_merge($default_content, $content);
|
|
} else {
|
|
$content = $default_content;
|
|
}
|
|
|
|
// Handle POST request to update content
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
// Update Hero
|
|
if (isset($_POST['hero_title'])) {
|
|
$content['hero_title'] = htmlspecialchars($_POST['hero_title']);
|
|
}
|
|
if (isset($_POST['hero_subtitle'])) {
|
|
$content['hero_subtitle'] = htmlspecialchars($_POST['hero_subtitle']);
|
|
}
|
|
|
|
// Update About
|
|
if (isset($_POST['about_title'])) {
|
|
$content['about_title'] = htmlspecialchars($_POST['about_title']);
|
|
}
|
|
if (isset($_POST['about_text'])) {
|
|
$content['about_text'] = htmlspecialchars($_POST['about_text']);
|
|
}
|
|
|
|
// Update Features Title
|
|
if (isset($_POST['features_title'])) {
|
|
$content['features_title'] = htmlspecialchars($_POST['features_title']);
|
|
}
|
|
|
|
// Update Features
|
|
if (isset($_POST['features']) && is_array($_POST['features'])) {
|
|
$updated_features = [];
|
|
foreach ($_POST['features'] as $feature_data) {
|
|
$updated_features[] = [
|
|
'icon' => htmlspecialchars($feature_data['icon']),
|
|
'title' => htmlspecialchars($feature_data['title']),
|
|
'description' => htmlspecialchars($feature_data['description'])
|
|
];
|
|
}
|
|
$content['features'] = $updated_features;
|
|
}
|
|
|
|
file_put_contents($content_file, json_encode($content, JSON_PRETTY_PRINT));
|
|
|
|
// Redirect to avoid form resubmission
|
|
header("Location: " . $_SERVER['REQUEST_URI']);
|
|
exit;
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>webCreatorSaas</title>
|
|
<meta name="description" content="Built with Flatlogic Generator">
|
|
<meta name="keywords" content="saas website builder, no-code website builder, drag and drop editor, custom website design, responsive web design, small business websites, portfolio websites, Flatlogic Generator">
|
|
<meta property="og:title" content="webCreatorSaas">
|
|
<meta property="og:description" content="Built with Flatlogic Generator">
|
|
<meta property="og:image" content="">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="">
|
|
|
|
<!-- Bootstrap 5 CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<!-- Bootstrap Icons -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<!-- Custom CSS -->
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Header -->
|
|
<header class="py-3 mb-4 border-bottom bg-white sticky-top">
|
|
<div class="container d-flex flex-wrap justify-content-center">
|
|
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
|
|
<i class="bi bi-gem me-2" style="font-size: 1.5rem; color: #6366F1;"></i>
|
|
<span class="fs-4 fw-bold">webCreatorSaas</span>
|
|
</a>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Main Content -->
|
|
<main>
|
|
<!-- Hero Section -->
|
|
<section class="hero-section text-center">
|
|
<div class="container">
|
|
<h1 class="display-4 fw-bold gradient-text"><?php echo htmlspecialchars($content['hero_title']); ?></h1>
|
|
<p class="lead my-4"><?php echo htmlspecialchars($content['hero_subtitle']); ?></p>
|
|
<a href="#" class="btn btn-primary btn-lg">Start Building for Free</a>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Features Section -->
|
|
<section id="features" class="py-5">
|
|
<div class="container">
|
|
<div class="text-center mb-5">
|
|
<h2 class="display-5 fw-bold"><?php echo htmlspecialchars($content['features_title']); ?></h2>
|
|
</div>
|
|
<div class="row g-4">
|
|
<?php foreach ($content['features'] as $feature): ?>
|
|
<div class="col-md-4">
|
|
<div class="text-center p-4">
|
|
<i class="<?php echo htmlspecialchars($feature['icon']); ?> gradient-text" style="font-size: 3rem;"></i>
|
|
<h4 class="fw-bold my-3"><?php echo htmlspecialchars($feature['title']); ?></h4>
|
|
<p class="text-muted"><?php echo htmlspecialchars($feature['description']); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- About Section -->
|
|
<section id="about" class="py-5 bg-light">
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-8 text-center">
|
|
<h2 class="display-5 fw-bold"><?php echo htmlspecialchars($content['about_title']); ?></h2>
|
|
<p class="lead my-4"><?php echo htmlspecialchars($content['about_text']); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Editor Section -->
|
|
<section class="editor-section">
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-8">
|
|
<div class="card p-4 p-md-5">
|
|
<h2 class="text-center mb-4"><i class="bi bi-pencil-square me-2"></i>Live Editor</h2>
|
|
<p class="text-center text-muted mb-4">Change the text in the sections above.</p>
|
|
<form method="POST" action="index.php">
|
|
<fieldset class="mb-4">
|
|
<legend class="h5">Hero Section</legend>
|
|
<div class="mb-3">
|
|
<label for="hero_title" class="form-label">Title</label>
|
|
<input type="text" class="form-control form-control-lg" id="hero_title" name="hero_title" value="<?php echo htmlspecialchars($content['hero_title']); ?>">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="hero_subtitle" class="form-label">Subtitle</label>
|
|
<textarea class="form-control" id="hero_subtitle" name="hero_subtitle" rows="3"><?php echo htmlspecialchars($content['hero_subtitle']); ?></textarea>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<fieldset class="mb-4">
|
|
<legend class="h5">Features Section</legend>
|
|
<div class="mb-3">
|
|
<label for="features_title" class="form-label">Section Title</label>
|
|
<input type="text" class="form-control" id="features_title" name="features_title" value="<?php echo htmlspecialchars($content['features_title']); ?>">
|
|
</div>
|
|
<?php foreach ($content['features'] as $index => $feature): ?>
|
|
<div class="mb-3 border-top pt-3">
|
|
<label class="form-label fw-bold">Feature <?php echo $index + 1; ?></label>
|
|
<div class="mb-2">
|
|
<label for="feature_icon_<?php echo $index; ?>" class="form-label small">Icon (Bootstrap Icon Class)</label>
|
|
<input type="text" class="form-control" id="feature_icon_<?php echo $index; ?>" name="features[<?php echo $index; ?>][icon]" value="<?php echo htmlspecialchars($feature['icon']); ?>">
|
|
</div>
|
|
<div class="mb-2">
|
|
<label for="feature_title_<?php echo $index; ?>" class="form-label small">Title</label>
|
|
<input type="text" class="form-control" id="feature_title_<?php echo $index; ?>" name="features[<?php echo $index; ?>][title]" value="<?php echo htmlspecialchars($feature['title']); ?>">
|
|
</div>
|
|
<div>
|
|
<label for="feature_description_<?php echo $index; ?>" class="form-label small">Description</label>
|
|
<textarea class="form-control" id="feature_description_<?php echo $index; ?>" name="features[<?php echo $index; ?>][description]" rows="2"><?php echo htmlspecialchars($feature['description']); ?></textarea>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</fieldset>
|
|
|
|
<fieldset class="mb-4">
|
|
<legend class="h5">About Section</legend>
|
|
<div class="mb-3">
|
|
<label for="about_title" class="form-label">Title</label>
|
|
<input type="text" class="form-control" id="about_title" name="about_title" value="<?php echo htmlspecialchars($content['about_title']); ?>">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="about_text" class="form-label">Text</label>
|
|
<textarea class="form-control" id="about_text" name="about_text" rows="4"><?php echo htmlspecialchars($content['about_text']); ?></textarea>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div class="d-grid">
|
|
<button type="submit" class="btn btn-primary btn-lg">Update All Content</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="container py-5">
|
|
<div class="row">
|
|
<div class="col-12 col-md text-center">
|
|
<p class="text-muted">© <?php echo date("Y"); ?> webCreatorSaas. Built with love by Flatlogic.</p>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Bootstrap 5 JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<!-- Custom JS -->
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|