<?php
  $thisPage="blog";
  $thissheet = "comment";
  require(__DIR__ . "/../layout/header.php");

  include __DIR__ . "./../../views/layout/css/navi.css";
  require __DIR__ . "/../layout/navigation.php"; ?>

  <div class="container">
    <div class="starter-template">
      <h3>Kommentar zum Post zufügen:</h3><?php
  // Topic aus posts ?>
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><?php echo "Post: ".e($post['title']); ?></h3>
          </div>
        </div><?php
  // Thema des posts?>
        <div class="panel-body">
          <?php echo  "<b>Inhalt: ".nl2br(e($post['content']))."</b>";?>
        </div><?php
  // Kommentare dazu auflisten ?>
        <ul class="list-group"><?php
        $i = 1;
          foreach($comments AS $comment):?>
            <li class="list-group-item"><?php
              echo $i.". "
              //echo "<br>ID=".$comment->id. " -> "
              .$comment->content;
              $i++; ?>
            </li>	            	            
          <?php endforeach; ?>
        </ul><?php
  // weiteres Kommentar Feld hinzufügen ?>
        <form method="post" action="post?id=<?php echo e($post['id']);?>">
          <textarea name="content" class="form-control"></textarea>
          </br>
          <input type="submit" value="Kommentar hinzufügen" class="btn btn-primary"/>
        </form>
        </br>
        </br>
      </div>
      <div class="w3-container">
        <a href="index" class="w3-btn w3-red">zurück</a>
      </div>
    </div>

  <?php
    include __DIR__ . "/../layout/footer.php";
  ?>
