Improve advertisement description handling for better compatibility

This commit is contained in:
Fabian Schieder 2026-03-30 23:50:04 +02:00
parent 6dd7adeb19
commit 3d5252ad12

View File

@ -123,10 +123,17 @@ if ($adProduct):
<div class="ad-tag">🔥 Empfehlung des Tages</div> <div class="ad-tag">🔥 Empfehlung des Tages</div>
<h2 class="ad-title"><?= htmlspecialchars($adProduct['model']) ?></h2> <h2 class="ad-title"><?= htmlspecialchars($adProduct['model']) ?></h2>
<p class="ad-description"> <p class="ad-description">
<?= htmlspecialchars(mb_strimwidth($adProduct['description'], 0, 150, "...")) ?> <?php
$desc = $adProduct['description'];
if (function_exists('mb_strimwidth')) {
$desc = mb_strimwidth($desc, 0, 150, "...");
} else {
$desc = strlen($desc) > 150 ? substr($desc, 0, 147) . "..." : $desc;
}
echo htmlspecialchars($desc);
?>
</p> </p>
<a href="productpage.php?id=<?= $adProduct['productID'] ?>" class="ad-btn">Jetzt entdecken</a> <a href="productpage.php?id=<?= $adProduct['productID'] ?>" class="ad-btn">Jetzt entdecken</a>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>