<?php

    require_once('refactoring.php');
    include_once('traitement.php');

    //selection un et un seul article grâce à son id pour afficher dans la page single
    $post = selectOne($id);
    //afficher le commentaire
    $comments = findAllComments($id);

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <!-- Custom Styling -->
  <link rel="stylesheet" href="css/style.css">

  <title>Article </title>
</head>

<body>

  <!-- Debut header -->
  <?php include('inc/header.php') ?>
  <!-- Fin header -->

  <!-- Page Wrapper -->
  <div class="page-container">

    <!-- Content -->
    <div class="container">

      <!-- Main Content Wrapper -->
      <div class="">
        <div class="main-content single">
          <h1 class="post-title"><?= $post['title']; ?></h1>
          <div class="post-image">
              <img src="<?='images/'.$post['image'];?>" alt="" >
          </div>
          <div class="post-content">    
                <?= $post['content'];?>
          </div><br><br>
          <small><strong><?= $post['author'];?> : </strong>Publié le 
          <?= date('d - M - Y',strtotime( $post['created_at']))?></small>
        </div>
        
      </div>
    </div>
  </div><br><br>
      <!-- // Main Content -->

     

  <!-- Debut footer -->
  <?php include('inc/footer.php')?>
  <!-- Fin footer --> 
</body>

</html>