Modularization of Hero
This commit is contained in:
parent
8f56e2f392
commit
d78176c3b7
|
|
@ -7,25 +7,43 @@ use WizdomNetworks\WizeWeb\Utils\ErrorHandler;
|
|||
/**
|
||||
* 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
|
||||
{
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
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');
|
||||
$formattedMessage = "[$timestamp] [$level]: $message" . PHP_EOL;
|
||||
|
||||
|
|
@ -33,11 +51,20 @@ class Logger
|
|||
file_put_contents(self::$logFile, $formattedMessage, FILE_APPEND | LOCK_EX);
|
||||
} catch (\Throwable $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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
@ -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.
|
||||
*/
|
||||
|
|
@ -78,3 +115,6 @@ class Logger
|
|||
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 {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
|
@ -42,3 +42,27 @@
|
|||
padding: 0.75rem 1.5rem;
|
||||
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';">
|
||||
|
||||
<!-- Main Stylesheet -->
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<link rel="stylesheet" href="/assets/css/styles.css">
|
||||
|
||||
<!-- Conditionally Load Hero Stylesheet -->
|
||||
<?php if (!empty($showHero)) : ?>
|
||||
<?php if (isset($heroConfig)) : ?>
|
||||
<link rel="stylesheet" href="/assets/css/hero.css">
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- Conditionally Load Slider Stylesheet -->
|
||||
<?php if (!empty($showSlider)) : ?>
|
||||
<?php if (isset($showSlider)) : ?>
|
||||
<link rel="stylesheet" href="/assets/css/slider.css">
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,17 @@
|
|||
<?php $this->render('layouts/head', $data); ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php if (!empty($showHeader)) : ?>
|
||||
<?php if (isset($showHeader)) : ?>
|
||||
<?php $this->render('layouts/header', $data); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $this->render('partials/navbar', $data); ?>
|
||||
|
||||
<?php if (!empty($heroConfig)) : ?>
|
||||
<?php if (isset($heroConfig)) : ?>
|
||||
<?php $this->render('partials/hero', compact('heroConfig')); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($showSlider)) : ?>
|
||||
<?php if (isset($showSlider)) : ?>
|
||||
<?php $this->render('partials/slider', ['sliderConfig' => $showSlider]); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
*/
|
||||
|
||||
$title = 'Home - Wizdom Networks';
|
||||
$showHeader = false;
|
||||
$showHero = false;
|
||||
$showSlider = ['type' => 'hero']; // Enable hero slider
|
||||
|
||||
$content = <<<HTML
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
<?php
|
||||
|
||||
$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
|
||||
<h1>Emergency Support</h1><p>We offer 24/7 emergency IT support to ensure your business operations run smoothly.</p>
|
||||
HTML;
|
||||
|
|
|
|||
Loading…
Reference in New Issue