folderweb/app/default/content/examples/mix-formats/02-dynamic.php

42 lines
1.2 KiB
PHP
Raw Normal View History

<?php
$currentTime = date('H:i:s');
$serverInfo = [
'PHP Version' => PHP_VERSION,
'Server Time' => $currentTime,
'Files in this directory' => count(glob(__DIR__ . '/*')),
];
?>
<section style="background: linear-gradient(135deg, oklch(95% 0.08 150), oklch(98% 0.04 150)); padding: var(--space-m); border-radius: 0.5rem; margin-block: var(--space-m);">
<h2 style="margin-block-start: 0;">PHP Component</h2>
<p>This section is rendered from <code>02-dynamic.php</code> a dynamic PHP file that executes server-side.</p>
<table style="width: 100%; margin-block: var(--space-s);">
<thead>
<tr>
<th>Property</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($serverInfo as $key => $value): ?>
<tr>
<td><?= htmlspecialchars($key) ?></td>
<td><strong><?= htmlspecialchars($value) ?></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p>PHP files can:</p>
<ul>
<li>Generate dynamic content</li>
<li>Query databases</li>
<li>Read from files or APIs</li>
<li>Calculate values on-the-fly</li>
<li>Include custom styling and logic</li>
</ul>
<p><em>Refresh this page to see the server time update!</em></p>
</section>