<?php
include_once "php/controller/showCategory-controller.php";
?>

<main>
    <?php include_once "includes/alertMessages.php"?>

    <h1><?php if (isset($category) && !empty($category)){ echo htmlspecialchars($category); } ?></h1>

    <div class="s-res-list">
        <?php
        if (!empty($articles)): ?>
            <?php foreach ($articles as $article): ?>
                <div class="s-res-item">
                    <div class="s-res-content">
                        <h2 class="s-res-item-title">
                            <a href="index.php?pfad=showArticle&id=<?php echo $article->getId(); ?>" class="s-res-link">
                                <?php echo htmlspecialchars($article->getTitle()); ?>
                            </a>
                        </h2>
                        <p class="s-res-author">Von: <span class="s-res-author-name"><?php echo htmlspecialchars($article->getAuthor()); ?></span></p>
                    </div>
                    <div class="s-res-arrow">&rarr;</div>
                </div>
            <?php endforeach; ?>
        <?php
        else: ?>
        <p> Es sind noch keine Beiträge in dieser Kategorie enthalten.</p>
        <?php endif; ?>
    </div>

</main>