<?= template()->push('meta') ?>
<title><?= $listing->blockMetaTitle($block) ?></title>
<meta name="description" content="<?= $listing->blockMetaDescription($block) ?>">
<?= template()->endPush() ?>
<h1><?= $listing->blockTitle($block) ?></h1>
<?= $listing->blockContent($block) ?>
<!-- DEMONSTRATION: Recommended Listings (Similar by Tags) -->
<?php $recommendedListings = $listing->fetchRecommended(5, true); ?>
<?php if (!$recommendedListings->isEmpty()): ?>
<section class="mb-5">
<h2 class="mb-4">Recommended for You</h2>
<p class="text-muted mb-3">
<em>Using: <code>$listing->fetchRecommended(3)</code> - Listings sharing tags with this one</em>
</p>
<div class="row">
<?php foreach ($recommendedListings as $recommendedListing): ?>
<div class="col-md-4 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?= _e($recommendedListing->replacedTitle()) ?></h5>
<p class="card-text text-muted fs-sm">
<?= substr($recommendedListing->replacedContent(), 0, 100) ?>...
</p>
<?php if (!$recommendedListing->tags->isEmpty()): ?>
<div class="mb-2">
<?php foreach ($recommendedListing->tags as $tag): ?>
<span class="badge badge-info fs-xs"><?= _e($tag->name) ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<a href="<?= route()->url('frontend.listings.show', ['id' => $recommendedListing->id]) ?>"
class="btn btn-sm btn-primary">View Details</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</section>
<?php endif; ?>-
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.