big update
This commit is contained in:
27
partials/structure/layout_end.php
Normal file
27
partials/structure/layout_end.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
$layoutScripts = $layoutScripts ?? [];
|
||||
if (!is_array($layoutScripts)) {
|
||||
$layoutScripts = [$layoutScripts];
|
||||
}
|
||||
?>
|
||||
<?php require __DIR__ . '/footer.php'; ?>
|
||||
<?php foreach ($layoutScripts as $script): ?>
|
||||
<?php if (is_string($script)): ?>
|
||||
<?= $script . PHP_EOL ?>
|
||||
<?php elseif (is_array($script) && isset($script['src'])): ?>
|
||||
<?php
|
||||
$attrs = [];
|
||||
if (!empty($script['defer'])) {
|
||||
$attrs[] = 'defer';
|
||||
}
|
||||
if (!empty($script['module'])) {
|
||||
$attrs[] = 'type="module"';
|
||||
} elseif (!empty($script['type'])) {
|
||||
$attrs[] = 'type="' . htmlspecialchars($script['type'], ENT_QUOTES) . '"';
|
||||
}
|
||||
?>
|
||||
<script src="<?= htmlspecialchars($script['src'], ENT_QUOTES) ?>" <?= implode(' ', $attrs) ?>></script>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user