lundi 17 mai 2021

PHP in echo'd HTML

If you're not logged in and don't have the id, the header should include "Inloggen" en "Aanmelden", if one is logged in and has the id, it should show "Uitloggen" which means "Logout". I'm echoing the HTML code, but I also want to run a PHP if else statement in the HTML code.

Header.php:

<?php

echo '<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="../Campingmaasvallei/images/logocamping2.png">
    <link rel="stylesheet" href="../Campingmaasvallei/css/reset.css">
    <link rel="stylesheet" href="../Campingmaasvallei/css/style.css">
    <title>Camping Maasvallei</title>
</head>

<body class="body-login">
    <header>        
        </div>
        <div class="container-header">
             <a href="index.php?home.php"> <img id="logo" src="../Campingmaasvallei/images/logocamping2.png"> </a> 
            <nav>
                <li><a href="index.php?home.php">Home</a></li>  
                <li><a href="index.php?page=omgeving">Omgeving</a></li>  
                <?php if (!isset($_SESSION['id'])){
                    <li><a href="index.php?page=login">Inloggen</a> </li>    
                    <li><a href="index.php?page=aanmelden">Aanmelden</a> </li>                
                }
                else{
                    <li><a href="index.php?page=logout">Uitloggen</a> </li>
                ?>
            </nav>
        </div>  
    </header>
    <div class="container">';
?>

Aucun commentaire:

Enregistrer un commentaire