dev auf main #68
+53
-39
@@ -2,59 +2,73 @@
|
|||||||
include_once "php/controller/showCategory-controller.php";
|
include_once "php/controller/showCategory-controller.php";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="category-results-container">
|
<div class="s-res-main-content">
|
||||||
<!-- Kategorie-Titel sicher ausgeben -->
|
<div class="s-res-header">
|
||||||
<h1>Kategorie: <?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : 'Unbekannt'; ?></h1>
|
<!-- Kategorie-Titel ausgeben -->
|
||||||
|
<h1 class="s-res-main-title">Kategorie: <?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : 'Unbekannt'; ?></h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 1. Die Artikel-Liste ausgeben -->
|
<!-- Artikel-Liste -->
|
||||||
<div class="articles-list">
|
<div class="s-res-list">
|
||||||
<?php if (isset($articles) && !empty($articles)): ?>
|
<?php if (isset($articles) && !empty($articles)): ?>
|
||||||
<?php foreach ($articles as $article): ?>
|
<?php foreach ($articles as $article): ?>
|
||||||
<article class="article-item">
|
<div class="s-res-item">
|
||||||
<h2><?php echo (isset($article) && !empty($article->getTitle())) ? htmlspecialchars($article->getTitle()) : 'Kein Titel'; ?></h2>
|
<div class="s-res-content">
|
||||||
<p><?php echo (isset($article) && !empty($article->getContent())) ? htmlspecialchars($article->getContent()) : 'Kein Inhalt'; ?></p>
|
<h2 class="s-res-item-title">
|
||||||
</article>
|
<?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 endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Keine Artikel in dieser Kategorie gefunden.</p>
|
<p class="s-res-meta">Keine Artikel in dieser Kategorie gefunden.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 2. Der Paginator (Nutzt exakt die Struktur aus deinem JS) -->
|
<!-- Der Paginator -->
|
||||||
<?php if (isset($totalPages) && $totalPages > 1): ?>
|
<?php if (isset($totalPages) && $totalPages > 1): ?>
|
||||||
<form id="search-form-id" action="index.php" method="GET" style="display: inline;">
|
<div class="s-res-pagination-footer">
|
||||||
|
<!-- Platzhalter für die linke Seite, damit die Buttons rechts aligned bleiben -->
|
||||||
|
<div></div>
|
||||||
|
|
||||||
<!-- Pfad und Kategorie als versteckte Felder mitsenden -->
|
<form id="search-form-id" action="index.php" method="GET" style="display: inline;">
|
||||||
<input type="hidden" name="pfad" value="showCategory">
|
<!-- Pfad und Kategorie als versteckte Felder mitsenden -->
|
||||||
<input type="hidden" name="category" value="<?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : ''; ?>">
|
<input type="hidden" name="pfad" value="showCategory">
|
||||||
|
<input type="hidden" name="category" value="<?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : ''; ?>">
|
||||||
|
|
||||||
<!-- Das Feld, das dein JS-Paginator befüllt -->
|
<!-- 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; ?>">
|
<input type="hidden" id="s-res-page-input" name="page" value="<?php echo (isset($page) && !empty($page)) ? $page : 1; ?>">
|
||||||
|
|
||||||
<!-- WICHTIG: Das Elternelement MUSS die Klasse 's-res-page-navigation' haben -->
|
<!-- Die originale Navigations-Struktur -->
|
||||||
<div class="s-res-page-navigation">
|
<div class="s-res-page-navigation">
|
||||||
|
|
||||||
<!-- Zurück-Button mit der Klasse 's-res-page-btn' -->
|
<!-- Zurück-Button -->
|
||||||
<?php $currentPage = $page ?? 1; ?>
|
<?php $currentPage = $page ?? 1; ?>
|
||||||
<button type="button" class="s-res-page-btn" data-page="<?php echo $currentPage - 1; ?>" <?php echo ($currentPage <= 1) ? 'disabled' : ''; ?>>
|
<button type="button" class="s-res-page-btn" data-page="<?php echo $currentPage - 1; ?>" <?php echo ($currentPage <= 1) ? 'disabled' : ''; ?>>
|
||||||
« Zurück
|
« Zurück
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Seitenzahlen mit der Klasse 's-res-page-btn' -->
|
|
||||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
|
||||||
<button type="button"
|
|
||||||
class="s-res-page-btn <?php echo ($i === $currentPage) ? 'active' : ''; ?>"
|
|
||||||
data-page="<?php echo $i; ?>"
|
|
||||||
<?php echo ($i === $currentPage) ? 'disabled' : ''; ?>>
|
|
||||||
<?php echo $i; ?>
|
|
||||||
</button>
|
</button>
|
||||||
<?php endfor; ?>
|
|
||||||
|
|
||||||
<!-- Vor-Button mit der Klasse 's-res-page-btn' -->
|
<!-- Seitenzahlen generieren -->
|
||||||
<button type="button" class="s-res-page-btn" data-page="<?php echo $currentPage + 1; ?>" <?php echo ($currentPage >= $totalPages) ? 'disabled' : ''; ?>>
|
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||||
Weiter »
|
<button type="button"
|
||||||
</button>
|
class="s-res-page-btn <?php echo ($i === $currentPage) ? 's-res-page-btn-active' : ''; ?>"
|
||||||
</div>
|
data-page="<?php echo $i; ?>"
|
||||||
</form>
|
<?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; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user