zitinexus-router-script/UI/debug-paths.php

54 lines
2.0 KiB
PHP

<?php
/**
* Debug script to check asset paths
*/
require_once 'includes/config.php';
echo "<h1>Asset Path Debug</h1>";
echo "<p><strong>Current Script:</strong> " . $_SERVER['SCRIPT_FILENAME'] . "</p>";
echo "<p><strong>Document Root:</strong> " . $_SERVER['DOCUMENT_ROOT'] . "</p>";
echo "<p><strong>Script Name:</strong> " . $_SERVER['SCRIPT_NAME'] . "</p>";
echo "<p><strong>Request URI:</strong> " . $_SERVER['REQUEST_URI'] . "</p>";
echo "<h2>Asset Paths:</h2>";
echo "<p><strong>CSS Path:</strong> " . getAssetPath('css/style.css') . "</p>";
echo "<p><strong>JS Path:</strong> " . getAssetPath('js/app.js') . "</p>";
echo "<h2>File Existence Check:</h2>";
$cssPath = getAssetPath('css/style.css');
$jsPath = getAssetPath('js/app.js');
echo "<p><strong>CSS File Exists:</strong> " . (file_exists($cssPath) ? 'YES' : 'NO') . " ($cssPath)</p>";
echo "<p><strong>JS File Exists:</strong> " . (file_exists($jsPath) ? 'YES' : 'NO') . " ($jsPath)</p>";
echo "<h2>Directory Structure:</h2>";
echo "<pre>";
echo "Current directory: " . getcwd() . "\n";
echo "Assets directory exists: " . (is_dir('assets') ? 'YES' : 'NO') . "\n";
echo "Public directory exists: " . (is_dir('public') ? 'YES' : 'NO') . "\n";
if (is_dir('assets')) {
echo "\nAssets directory contents:\n";
$files = scandir('assets');
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
echo " - $file\n";
if (is_dir("assets/$file")) {
$subfiles = scandir("assets/$file");
foreach ($subfiles as $subfile) {
if ($subfile !== '.' && $subfile !== '..') {
echo " - $subfile\n";
}
}
}
}
}
}
echo "</pre>";
echo "<h2>Test Direct Paths:</h2>";
echo "<p><strong>Direct CSS:</strong> assets/css/style.css - " . (file_exists('assets/css/style.css') ? 'EXISTS' : 'NOT FOUND') . "</p>";
echo "<p><strong>Direct JS:</strong> assets/js/app.js - " . (file_exists('assets/js/app.js') ? 'EXISTS' : 'NOT FOUND') . "</p>";
?>