Update showCategory.php
This commit is contained in:
+24
-16
@@ -4,23 +4,41 @@ include_once "php/controller/showCategory-controller.php";
|
||||
|
||||
<div class="s-res-main-content">
|
||||
<div class="s-res-header">
|
||||
<!-- Kategorie-Titel ausgeben -->
|
||||
<!-- Kategorie-Titel im exakten Stil der Suchergebnisse -->
|
||||
<h1 class="s-res-main-title">Kategorie: <?php echo (isset($category) && !empty($category)) ? htmlspecialchars($category) : 'Unbekannt'; ?></h1>
|
||||
<p class="s-res-meta">Beiträge in dieser Kategorie</p>
|
||||
</div>
|
||||
|
||||
<!-- Artikel-Liste -->
|
||||
<!-- Die 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">
|
||||
<!-- Titel als klickbarer Link wie im Original -->
|
||||
<h2 class="s-res-item-title">
|
||||
<?php echo (isset($article) && !empty($article->getTitle())) ? htmlspecialchars($article->getTitle()) : 'Kein Titel'; ?>
|
||||
<a href="#" class="s-res-link">
|
||||
<?php echo (isset($article) && !empty($article->getTitle())) ? htmlspecialchars($article->getTitle()) : 'Kein Titel'; ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p>
|
||||
|
||||
<!-- Die fehlende Meta-Zeile für Autor und Likes für das richtige Design -->
|
||||
<div class="s-res-meta-row">
|
||||
<p class="s-res-author">
|
||||
von <span class="s-res-author-name"><?php echo (isset($article) && !empty($article->getAuthor())) ? htmlspecialchars($article->getAuthor()) : 'Anonym'; ?></span>
|
||||
</p>
|
||||
<!-- Likes Anzeige (Falls dein Objekt getLikes() oder getLikeCount() hat) -->
|
||||
<span class="s-res-likes">
|
||||
❤ <?php echo (isset($article) && !empty($article->getLikes())) ? htmlspecialchars($article->getLikes()) : '0'; ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Beschreibungstext -->
|
||||
<p style="margin-top: 0.5rem; color: #4a5568;">
|
||||
<?php echo (isset($article) && !empty($article->getContent())) ? htmlspecialchars($article->getContent()) : 'Kein Inhalt'; ?>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Der originale Pfeil rechts -->
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@@ -29,30 +47,22 @@ include_once "php/controller/showCategory-controller.php";
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Der Paginator -->
|
||||
<!-- 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>
|
||||
<div></div> <!-- Hält die Buttons auf der rechten Seite -->
|
||||
|
||||
<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' : ''; ?>"
|
||||
@@ -62,7 +72,6 @@ include_once "php/controller/showCategory-controller.php";
|
||||
</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>
|
||||
@@ -71,4 +80,3 @@ include_once "php/controller/showCategory-controller.php";
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user