zitinexus-router-script/UI/test/test-assets.php

62 lines
2.1 KiB
PHP

<?php
/**
* Simple test to verify asset paths and file existence
*/
echo "<h1>Asset Path Test</h1>";
// Test direct paths (for root-level access)
echo "<h2>Direct Asset Paths (Root Level Access)</h2>";
echo "<p><strong>CSS:</strong> assets/css/style.css</p>";
echo "<p><strong>JS:</strong> assets/js/app.js</p>";
// Check if files exist
echo "<h2>File Existence Check</h2>";
echo "<p><strong>CSS exists:</strong> " . (file_exists('assets/css/style.css') ? 'YES' : 'NO') . "</p>";
echo "<p><strong>JS exists:</strong> " . (file_exists('assets/js/app.js') ? 'YES' : 'NO') . "</p>";
// Test actual links
echo "<h2>Test Links</h2>";
echo '<p><a href="assets/css/style.css" target="_blank">Test CSS Link</a></p>';
echo '<p><a href="assets/js/app.js" target="_blank">Test JS Link</a></p>';
// Show current directory
echo "<h2>Current Directory Info</h2>";
echo "<p><strong>Current working directory:</strong> " . getcwd() . "</p>";
echo "<p><strong>Script filename:</strong> " . $_SERVER['SCRIPT_FILENAME'] . "</p>";
echo "<p><strong>Document root:</strong> " . $_SERVER['DOCUMENT_ROOT'] . "</p>";
// List assets directory
echo "<h2>Assets Directory Contents</h2>";
if (is_dir('assets')) {
echo "<ul>";
$files = scandir('assets');
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
echo "<li>$file";
if (is_dir("assets/$file")) {
echo " (directory)";
$subfiles = scandir("assets/$file");
echo "<ul>";
foreach ($subfiles as $subfile) {
if ($subfile !== '.' && $subfile !== '..') {
echo "<li>$subfile</li>";
}
}
echo "</ul>";
}
echo "</li>";
}
}
echo "</ul>";
} else {
echo "<p>Assets directory not found!</p>";
}
// Test with HTML
echo "<h2>HTML Test</h2>";
echo '<div style="color: red; font-weight: bold;">This text should be red if CSS is not loading</div>';
echo '<link rel="stylesheet" href="assets/css/style.css">';
echo '<div class="btn btn-primary">This should be styled if CSS loads</div>';
?>