Use plain HTML in the header + only show 'Nouvelle recette' if user is login

This commit is contained in:
Thomas Rubini 2023-01-25 22:45:35 +01:00
parent fce1da9070
commit 488fc7c510
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -1,20 +1,18 @@
<?php
$array_header = array(
'<img src="/static/img/logo.png" alt="Logo">' => "/",
"Catégories" => "/category",
"Nouvelle recette" => "/recipe/new",
"Recherche" => "rechercher",
'<img src="/static/img/default_user.svg" type="image/svg+xml">' => "/user/view"
);
?>
<header>
<nav>
<ul>
<?php
foreach ($array_header as $key => $value) {
echo '<li><a href="'.$value.'">'.$key.'</a></li>';
}
?>
<li><a href="/">
<img src="/static/img/logo.png" alt="Logo">
</a></li>
<li><a href="/category">Catégories</a></li>
<?php if (Session::is_login()) { ?>
<li><a href="/recipe/new">Nouvelle recette</a></li>
<?php } ?>
<li><a href="/recipe/search">Rechercher</a></li>
<li><a href="/user/view">
<img src="/static/img/default_user.svg" type="image/svg+xml">
</a></li>
</ul>
</nav>
</header>