🎨 Integrated Arsha template as v1 landing page
|
|
@ -4,10 +4,10 @@
|
|||
// Purpose: Handles landing page rendering for Arsha one-pager
|
||||
// Project: Wizdom Networks Website
|
||||
|
||||
namespace WizdomNetworks\WizdomWeb\Controllers;
|
||||
namespace WizdomNetworks\WizeWeb\Controllers;
|
||||
|
||||
use WizdomNetworks\WizdomWeb\Utils\View;
|
||||
use WizdomNetworks\WizdomWeb\Utils\Logger;
|
||||
use WizdomNetworks\WizeWeb\Core\View;
|
||||
use WizdomNetworks\WizeWeb\Utils\Logger;
|
||||
|
||||
class LandingController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,10 +57,18 @@ class Router
|
|||
Logger::error("Controller not found: $controllerName");
|
||||
throw new \Exception("Controller $controllerName not found.");
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
ErrorHandler::exception($e);
|
||||
Logger::error("Router dispatch error: " . $e->getMessage());
|
||||
echo "500 Internal Server Error";
|
||||
} //catch (\Throwable $e) {
|
||||
//ErrorHandler::exception($e);
|
||||
//Logger::error("Router dispatch error: " . $e->getMessage());
|
||||
//echo "500 Internal Server Error";
|
||||
catch (\Throwable $e) {
|
||||
echo "<pre>";
|
||||
echo "Exception: " . $e->getMessage() . "\n";
|
||||
echo "File: " . $e->getFile() . "\n";
|
||||
echo "Line: " . $e->getLine() . "\n";
|
||||
echo "Trace:\n" . $e->getTraceAsString();
|
||||
echo "</pre>";
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
Logger::error("Route not found: $path");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
<?php
|
||||
|
||||
// ============================================
|
||||
// File: View.php
|
||||
// Version: 1.1
|
||||
// Path: app/Core/View.php
|
||||
// Purpose: Handles dynamic view rendering with optional layout wrapping
|
||||
// Project: Wizdom Networks Website
|
||||
// Usage: View::render('pages/landing', $data, 'arsha')
|
||||
// ============================================
|
||||
|
||||
|
||||
namespace WizdomNetworks\WizeWeb\Core;
|
||||
|
||||
use WizdomNetworks\WizeWeb\Utils\Logger;
|
||||
|
|
@ -13,34 +23,49 @@ use WizdomNetworks\WizeWeb\Utils\ErrorHandler;
|
|||
class View
|
||||
{
|
||||
/**
|
||||
* Renders a view file and passes data to it.
|
||||
* Renders a view file and optionally wraps it in a layout.
|
||||
*
|
||||
* @param string $view The name of the view file (relative to /resources/views/).
|
||||
* @param array $data Associative array of variables to pass to the view.
|
||||
* @throws \Exception If the view file is not found.
|
||||
* @param string|null $layout The layout to use (relative to /resources/views/layouts/). Default is null (no layout).
|
||||
* @throws \Exception If the view or layout file is not found.
|
||||
*/
|
||||
public static function render(string $view, array $data = []): void
|
||||
public static function render(string $view, array $data = [], ?string $layout = null): void
|
||||
{
|
||||
Logger::debug("Rendering view: $view");
|
||||
|
||||
// Extract data to make variables available in the view
|
||||
extract($data);
|
||||
|
||||
// Build the full path to the view file
|
||||
Logger::debug("[DEBUG] Attempting to load view: " . $view . " | Expected path: " . __DIR__ . "/../../resources/views/" . str_replace('.', '/', $view) . ".php");
|
||||
|
||||
$viewPath = realpath(__DIR__ . "/../../resources/views/" . str_replace('.', '/', $view) . ".php");
|
||||
|
||||
// Debugging: Log resolved path
|
||||
Logger::debug("Resolved view path: $viewPath");
|
||||
|
||||
// Validate and include the view file
|
||||
if ($viewPath && file_exists($viewPath)) {
|
||||
include $viewPath;
|
||||
Logger::debug("Successfully rendered view: $view");
|
||||
} else {
|
||||
// If using layout, resolve layout path
|
||||
if ($layout) {
|
||||
$layoutPath = realpath(__DIR__ . "/../../resources/views/layouts/" . $layout . ".php");
|
||||
Logger::debug("Resolved layout path: $layoutPath");
|
||||
|
||||
if (!$layoutPath || !file_exists($layoutPath)) {
|
||||
Logger::error("Layout file not found: $layout");
|
||||
throw new \Exception("Layout file not found: $layout");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$viewPath || !file_exists($viewPath)) {
|
||||
Logger::error("View file not found: $view | Resolved path: $viewPath");
|
||||
throw new \Exception("View file not found: $view");
|
||||
}
|
||||
|
||||
// If using a layout, buffer content then inject into layout
|
||||
if ($layout) {
|
||||
ob_start();
|
||||
include $viewPath;
|
||||
$content = ob_get_clean();
|
||||
include $layoutPath;
|
||||
Logger::debug("Successfully rendered view: $view into layout: $layout");
|
||||
} else {
|
||||
include $viewPath;
|
||||
Logger::debug("Successfully rendered view: $view (no layout)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
[2025-05-08 00:33:46] [INFO]: Bootstrapping application
|
||||
[2025-05-08 00:33:46] [ERROR]: Route not found: index.php
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/* Bootstrap Optimization for Mobile & Desktop Consistency */
|
||||
/* Main Styling: main.css */
|
||||
/* Ensure proper grid scaling */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Navigation Fixes */
|
||||
.navbar {
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
|
||||
/* Adjust button sizes for better touchscreen usability */
|
||||
.btn {
|
||||
padding: 0.75rem 1.5rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Improve form inputs on mobile */
|
||||
.form-control {
|
||||
padding: 0.75rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Ensure text scaling remains readable */
|
||||
body {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 0 15px;
|
||||
}
|
||||
.navbar-nav {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 423 KiB |
|
Before Width: | Height: | Size: 291 KiB After Width: | Height: | Size: 291 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 297 KiB |
|
Before Width: | Height: | Size: 798 KiB After Width: | Height: | Size: 798 KiB |
|
Before Width: | Height: | Size: 942 KiB After Width: | Height: | Size: 942 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 462 KiB |
|
Before Width: | Height: | Size: 286 KiB After Width: | Height: | Size: 286 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 173 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 315 KiB After Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 426 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 614 KiB After Width: | Height: | Size: 614 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 943 KiB After Width: | Height: | Size: 943 KiB |
|
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
|
Before Width: | Height: | Size: 596 KiB After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 924 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 292 KiB |