Changed the function displayDebug, now using a div with a 'debug-target-container' to place the debug bar'

This commit is contained in:
2026-08-04 16:39:17 +01:00
parent 5f0cf85abe
commit 34de1baaa5
3 changed files with 28 additions and 8 deletions
+25 -7
View File
@@ -82,25 +82,26 @@ function debugStatusMes( string $Message, string $intensity) {
} }
} }
// DISPLAY DEBUG ERROR FOOTER BAR // DISPLAY DEBUG ERROR BAR
function displayDebugFooter() { function displayDebug() {
global $debug, $debug_messages; global $debug, $debug_messages;
if ($debug !== "on") { if ($debug !== "on") {
return; return;
} }
echo '<div id="debug-footer-container" style="background: #222; color: #fff; padding: 15px; font-family: monospace; border-top: 3px solid #ff4444; margin-top: 30px;">'; // Contenitore temporaneo nascosto per non creare sfarfallii nella pagina
echo '<h3>⚙️ Debug Status Messages</h3>'; echo '<div id="debug-source-content" style="display: none;">';
echo '<div style="background: #222; color: #fff; padding: 15px; font-family: monospace; border-bottom: 3px solid #ff4444; border-top: 3px solid #ff4444; margin-bottom: 20px;">';
echo '<h3 style="margin-bottom:5px;">⚙️ Debug Status Messages</h3>';
foreach ($debug_messages as $level => $messages) { foreach ($debug_messages as $level => $messages) {
if (!empty($messages)) { if (!empty($messages)) {
// Assegna un colore diverso in base alla gravità $color = '#6cef93';
$color = '#d3fcc8'; // Default Low
if ($level === 'High') $color = '#ff4444'; if ($level === 'High') $color = '#ff4444';
if ($level === 'Medium') $color = '#ffbb33'; if ($level === 'Medium') $color = '#ffbb33';
echo "<div class='debug-group' style='margin-bottom: 10px;'>"; echo "<div style='margin-bottom: 10px;'>";
echo "<strong style='color: $color;'>[" . $level . "]</strong>"; echo "<strong style='color: $color;'>[" . $level . "]</strong>";
echo "<ul style='margin: 5px 0; padding-left: 20px;'>"; echo "<ul style='margin: 5px 0; padding-left: 20px;'>";
foreach ($messages as $msg) { foreach ($messages as $msg) {
@@ -111,4 +112,21 @@ function displayDebugFooter() {
} }
} }
echo '</div>'; echo '</div>';
echo '</div>';
// Questo script JS prende il contenuto appena generato e lo sposta nel segnaposto in cima
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
const source = document.getElementById('debug-source-content');
const target = document.getElementById('debug-target-container');
if (source && target) {
// Sposta l'HTML dentro il contenitore all'inizio del body
target.innerHTML = source.innerHTML;
// Rimuove il vecchio elemento nascosto per pulizia
source.remove();
}
});
</script>
<?php
} }
+1 -1
View File
@@ -4,6 +4,6 @@
<div class="webmaster_footer">Website designed by Simone Cusano - SimoLinuxDesign.org</div> <div class="webmaster_footer">Website designed by Simone Cusano - SimoLinuxDesign.org</div>
</footer> </footer>
<?php include(INCLUDES_FOLD . "js_footer.php"); ?> <?php include(INCLUDES_FOLD . "js_footer.php"); ?>
<?php displayDebugFooter(); ?> <?php displayDebug(); ?>
</body> </body>
</html> </html>
+2
View File
@@ -7,6 +7,8 @@
<title><?php echo ucfirst($GLOBALS["current_page"] ?? "Home"); ?></title> <title><?php echo ucfirst($GLOBALS["current_page"] ?? "Home"); ?></title>
</head> </head>
<body> <body>
<div id="debug-target-container"></div>
<header> <header>
<ul class="main-nav"> <ul class="main-nav">
<li><a href="#">Home</a></li> <li><a href="#">Home</a></li>