Modularization of Hero
This commit is contained in:
parent
8f56e2f392
commit
d78176c3b7
|
|
@ -7,25 +7,43 @@ use WizdomNetworks\WizeWeb\Utils\ErrorHandler;
|
||||||
/**
|
/**
|
||||||
* Logger Utility
|
* Logger Utility
|
||||||
*
|
*
|
||||||
* A utility class for logging messages to a file.
|
* A utility class for logging messages to a file with environment-based debug control.
|
||||||
*
|
*
|
||||||
* Supports logging messages at different levels (INFO, WARNING, ERROR) with timestamps.
|
* Supports different log levels and dynamic debugging based on an environment variable.
|
||||||
*/
|
*/
|
||||||
class Logger
|
class Logger
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string The path to the log file.
|
* @var string The path to the log file.
|
||||||
*/
|
*/
|
||||||
protected static string $logFile = __DIR__ . '/../../logs/app.log';
|
protected static string $logFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool Flag to enable or disable debug logging.
|
||||||
|
*/
|
||||||
|
protected static bool $debugEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize Logger settings from environment variables.
|
||||||
|
*/
|
||||||
|
public static function init(): void
|
||||||
|
{
|
||||||
|
self::$logFile = getenv('LOG_FILE_PATH') ?: __DIR__ . '/../../logs/app.log';
|
||||||
|
self::$debugEnabled = getenv('APP_DEBUG') === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a message to the log file.
|
* Logs a message to the log file.
|
||||||
*
|
*
|
||||||
* @param string $level The log level (e.g., INFO, WARNING, ERROR).
|
* @param string $level The log level (DEBUG, INFO, WARNING, ERROR, CRITICAL).
|
||||||
* @param string $message The log message.
|
* @param string $message The log message.
|
||||||
*/
|
*/
|
||||||
public static function log(string $level, string $message): void
|
public static function log(string $level, string $message): void
|
||||||
{
|
{
|
||||||
|
if ($level === 'DEBUG' && !self::$debugEnabled) {
|
||||||
|
return; // Skip debug logs if debugging is disabled
|
||||||
|
}
|
||||||
|
|
||||||
$timestamp = date('Y-m-d H:i:s');
|
$timestamp = date('Y-m-d H:i:s');
|
||||||
$formattedMessage = "[$timestamp] [$level]: $message" . PHP_EOL;
|
$formattedMessage = "[$timestamp] [$level]: $message" . PHP_EOL;
|
||||||
|
|
||||||
|
|
@ -33,11 +51,20 @@ class Logger
|
||||||
file_put_contents(self::$logFile, $formattedMessage, FILE_APPEND | LOCK_EX);
|
file_put_contents(self::$logFile, $formattedMessage, FILE_APPEND | LOCK_EX);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ErrorHandler::exception($e);
|
ErrorHandler::exception($e);
|
||||||
// Fallback to PHP's error_log if writing to the file fails
|
|
||||||
error_log("[ERROR] Logging to file failed: " . $e->getMessage());
|
error_log("[ERROR] Logging to file failed: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs a debug message (only if DEBUG is enabled).
|
||||||
|
*
|
||||||
|
* @param string $message The log message.
|
||||||
|
*/
|
||||||
|
public static function debug(string $message): void
|
||||||
|
{
|
||||||
|
self::log('DEBUG', $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an informational message.
|
* Logs an informational message.
|
||||||
*
|
*
|
||||||
|
|
@ -69,7 +96,17 @@ class Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the log file path.
|
* Logs a critical error message.
|
||||||
|
*
|
||||||
|
* @param string $message The log message.
|
||||||
|
*/
|
||||||
|
public static function critical(string $message): void
|
||||||
|
{
|
||||||
|
self::log('CRITICAL', $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the log file path dynamically.
|
||||||
*
|
*
|
||||||
* @param string $filePath The path to the log file.
|
* @param string $filePath The path to the log file.
|
||||||
*/
|
*/
|
||||||
|
|
@ -78,3 +115,6 @@ class Logger
|
||||||
self::$logFile = $filePath;
|
self::$logFile = $filePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize Logger on class load
|
||||||
|
Logger::init();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Hero Section Styling */
|
/* Hero Section Styling - Modular Support for Different Layouts */
|
||||||
.hero-section {
|
.hero-section {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -42,3 +42,27 @@
|
||||||
padding: 0.75rem 1.5rem;
|
padding: 0.75rem 1.5rem;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compact Hero Style */
|
||||||
|
.hero-compact {
|
||||||
|
height: 40vh;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding-top: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Overlay Hero Style */
|
||||||
|
.hero-overlay .hero-content {
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
padding: 1.5rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Inline Hero Positioning */
|
||||||
|
.hero-inline {
|
||||||
|
height: auto;
|
||||||
|
padding: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-inline .hero-content {
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,16 @@
|
||||||
onerror="this.onerror=null;this.href='/assets/bootstrap/css/bootstrap.min.css';">
|
onerror="this.onerror=null;this.href='/assets/bootstrap/css/bootstrap.min.css';">
|
||||||
|
|
||||||
<!-- Main Stylesheet -->
|
<!-- Main Stylesheet -->
|
||||||
<link rel="stylesheet" href="/assets/css/main.css">
|
<link rel="stylesheet" href="/assets/css/styles.css">
|
||||||
|
|
||||||
<!-- Conditionally Load Hero Stylesheet -->
|
<!-- Conditionally Load Hero Stylesheet -->
|
||||||
<?php if (!empty($showHero)) : ?>
|
<?php if (isset($heroConfig)) : ?>
|
||||||
<link rel="stylesheet" href="/assets/css/hero.css">
|
<link rel="stylesheet" href="/assets/css/hero.css">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<!-- Conditionally Load Slider Stylesheet -->
|
<!-- Conditionally Load Slider Stylesheet -->
|
||||||
<?php if (!empty($showSlider)) : ?>
|
<?php if (isset($showSlider)) : ?>
|
||||||
<link rel="stylesheet" href="/assets/css/slider.css">
|
<link rel="stylesheet" href="/assets/css/slider.css">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,17 @@
|
||||||
<?php $this->render('layouts/head', $data); ?>
|
<?php $this->render('layouts/head', $data); ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php if (!empty($showHeader)) : ?>
|
<?php if (isset($showHeader)) : ?>
|
||||||
<?php $this->render('layouts/header', $data); ?>
|
<?php $this->render('layouts/header', $data); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php $this->render('partials/navbar', $data); ?>
|
<?php $this->render('partials/navbar', $data); ?>
|
||||||
|
|
||||||
<?php if (!empty($heroConfig)) : ?>
|
<?php if (isset($heroConfig)) : ?>
|
||||||
<?php $this->render('partials/hero', compact('heroConfig')); ?>
|
<?php $this->render('partials/hero', compact('heroConfig')); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($showSlider)) : ?>
|
<?php if (isset($showSlider)) : ?>
|
||||||
<?php $this->render('partials/slider', ['sliderConfig' => $showSlider]); ?>
|
<?php $this->render('partials/slider', ['sliderConfig' => $showSlider]); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$title = 'Home - Wizdom Networks';
|
$title = 'Home - Wizdom Networks';
|
||||||
$showHeader = false;
|
|
||||||
$showHero = false;
|
|
||||||
$showSlider = ['type' => 'hero']; // Enable hero slider
|
$showSlider = ['type' => 'hero']; // Enable hero slider
|
||||||
|
|
||||||
$content = <<<HTML
|
$content = <<<HTML
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$title = 'Emergency Support - Wizdom Networks';
|
$title = 'Emergency Support - Wizdom Networks';
|
||||||
|
$heroConfig = [
|
||||||
|
'title' => 'Innovative IT Solutions',
|
||||||
|
'description' => 'Empowering businesses with cutting-edge technology solutions.',
|
||||||
|
'image' => '/assets/images/rescue-training.jpg',
|
||||||
|
'cta' => ['text' => 'Learn More', 'link' => '/services'],
|
||||||
|
'style' => 'default',
|
||||||
|
'position' => 'top'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
$content = <<<HTML
|
$content = <<<HTML
|
||||||
<h1>Emergency Support</h1><p>We offer 24/7 emergency IT support to ensure your business operations run smoothly.</p>
|
<h1>Emergency Support</h1><p>We offer 24/7 emergency IT support to ensure your business operations run smoothly.</p>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue