caelum-bludit-theme/php/header.php
2024-08-17 17:30:35 +02:00

36 lines
1.3 KiB
PHP
Executable file

<header id="page-header" class="flex">
<nav class="navbar-pages" aria-label="Navigation principale">
<ul>
<li>
<a href="<?php echo Theme::siteUrl() ?>" class="button">
<svg class="icon icon-home" alt=""><use xlink:href="#icon-home"></use></svg> Accueil
</a>
</li>
<?php foreach ($staticContent as $tmp) : ?>
<?php if ($tmp->position() < 10 && $tmp->position() > 1) : ?>
<li><a class="button soft" href="<?php echo $tmp->permalink(); ?>"><?php echo $tmp->title(); ?></a></li>
<?php endif ?>
<?php endforeach ?>
</ul>
</nav>
<form id="searchform">
<div class="ml-half">
<label for="searchfield" class="sr-only">Formulaire de recherche</label>
<input class="form-control" id="searchfield" type="search" placeholder="Rechercher sur le blog" aria-label="Rechercher sur le blog" value="" name="s" id="s" />
</div>
<script>
function searchNow() {
var searchURL = "<?php echo Theme::siteUrl(); ?>search/";
window.open(searchURL + document.getElementById("searchfield").value, "_self");
}
document.getElementById("searchfield").onkeypress = function(e) {
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13' && document.getElementById("searchfield").value !== "") {
searchNow();
return false;
}
}
</script>
</form>
</header>