75 lines
3.5 KiB
PHP
75 lines
3.5 KiB
PHP
<?php
|
|
include_once "php/controller/showCategory-controller.php";
|
|
?>
|
|
|
|
<div class="s-res-main-content">
|
|
<div class="s-res-header">
|
|
<!-- Kategorie-Titel ausgeben -->
|
|
<h1 class="s-res-main-title">Kategorie: <?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : 'Unbekannt'; ?></h1>
|
|
</div>
|
|
|
|
<!-- Artikel-Liste -->
|
|
<div class="s-res-list">
|
|
<?php if (isset($articles) && !empty($articles)): ?>
|
|
<?php foreach ($articles as $article): ?>
|
|
<div class="s-res-item">
|
|
<div class="s-res-content">
|
|
<h2 class="s-res-item-title">
|
|
<?php echo (isset($article) && !empty($article->getTitle())) ? htmlspecialchars($article->getTitle()) : 'Kein Titel'; ?>
|
|
</h2>
|
|
<p>
|
|
<?php echo (isset($article) && !empty($article->getContent())) ? htmlspecialchars($article->getContent()) : 'Kein Inhalt'; ?>
|
|
</p>
|
|
</div>
|
|
<div class="s-res-arrow">→</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<p class="s-res-meta">Keine Artikel in dieser Kategorie gefunden.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Der Paginator -->
|
|
<?php if (isset($totalPages) && $totalPages > 1): ?>
|
|
<div class="s-res-pagination-footer">
|
|
<!-- Platzhalter für die linke Seite, damit die Buttons rechts aligned bleiben -->
|
|
<div></div>
|
|
|
|
<form id="search-form-id" action="index.php" method="GET" style="display: inline;">
|
|
<!-- Pfad und Kategorie als versteckte Felder mitsenden -->
|
|
<input type="hidden" name="pfad" value="showCategory">
|
|
<input type="hidden" name="category" value="<?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : ''; ?>">
|
|
|
|
<!-- Das Feld für dein JS-Paginator -->
|
|
<input type="hidden" id="s-res-page-input" name="page" value="<?php echo (isset($page) && !empty($page)) ? $page : 1; ?>">
|
|
|
|
<!-- Die originale Navigations-Struktur -->
|
|
<div class="s-res-page-navigation">
|
|
|
|
<!-- Zurück-Button -->
|
|
<?php $currentPage = $page ?? 1; ?>
|
|
<button type="button" class="s-res-page-btn" data-page="<?php echo $currentPage - 1; ?>" <?php echo ($currentPage <= 1) ? 'disabled' : ''; ?>>
|
|
« Zurück
|
|
</button>
|
|
|
|
<!-- Seitenzahlen generieren -->
|
|
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
|
<button type="button"
|
|
class="s-res-page-btn <?php echo ($i === $currentPage) ? 's-res-page-btn-active' : ''; ?>"
|
|
data-page="<?php echo $i; ?>"
|
|
<?php echo ($i === $currentPage) ? 'disabled' : ''; ?>>
|
|
<?php echo $i; ?>
|
|
</button>
|
|
<?php endfor; ?>
|
|
|
|
<!-- Vor-Button -->
|
|
<button type="button" class="s-res-page-btn" data-page="<?php echo $currentPage + 1; ?>" <?php echo ($currentPage >= $totalPages) ? 'disabled' : ''; ?>>
|
|
Weiter »
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|