Listings -
3 Files
- block.php - in case of jobsalary.in, block.php will have all recruitment details without much edit or worry of duplicacy worries.
in the present cms, how to make more blocks - result, admit card, etc.. - index.php - Index of listings - main landing page of all listings. - not that important.
- show.php - One individual listing. - very important
block.php
<?= template()->layout('frontend/layout') ?>
<?= 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; ?>
index.php
<?= template()->layout('frontend/layout') ?>
<?= template()->push('meta') ?>
<title>Listings</title>
<meta name="description" content="All listings displayed here">
<?= template()->endPush() ?>
<table class="table">
<?php foreach ($listings as $listing): ?>
<tr>
<td><?= $listing->replacedTitle() ?></td>
<td>
<a href="<?= route()->url('frontend.listings.show', ['id' => $listing->id]) ?>">
Read more
</a>
</td>
</tr>
<?php endforeach; ?>
</table>
show.php
<?= template()->layout('frontend/layout') ?>
<?= template()->push('meta') ?>
<title><?= $listing->replacedMetaTitle() ?: $listing->keyField('organisation') ?></title>
<meta name="description" content="<?= ($listing->replacedMetaDescription() ?? '') !== ''
? $listing->replacedMetaDescription()
: $listing->keyField('organisation') ?>
">
<?= template()->endPush() ?>
<div class="container py-5">
<!-- Main Listing Content -->
<article class="mb-5">
<h1 class="mb-3"><?= $listing->replacedTitle() ?></h1>
<!-- Tags Display -->
<?php if (!$listing->tags->isEmpty()): ?>
<div class="mb-4">
<strong>Tags:</strong>
<?php foreach ($listing->tags as $tag): ?>
<span class="badge badge-info me-2"><?= _e($tag->name) ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="mb-4">
<p><?= $listing->replacedContent() ?></p>
<?= $listing->keyField('organisation') ?>
</div>
<h3>Custom Fields</h3>
<table class="table mb-4">
<?php foreach ($listing->getFields() as $field): ?>
<tr>
<td><strong><?= _e($field->label) ?></strong></td>
<td><?= $field->value ?></td>
</tr>
<?php endforeach; ?>
</table>
<h3>Feilds by Key</h3>
<table class="table mb-4">
<tr>
<td><strong>Price</strong></td>
<td><?= $listing->keyField('price') ?></td>
</tr>
<tr>
<td><strong>Non-Existing</strong></td>
<td><?= $listing->keyField('non-existing') ?></td>
</tr>
</table>
<h3>Blocks</h3>
<table class="table mb-4">
<?php foreach ($listing->mappedBlocks() as $block): ?>
<tr>
<td><?= $block->title ?></td>
<td>
<a
href="<?= route()->url('frontend.listings.blocks.show', ['listingId' => $listing->id, 'blockId' => $block->id]) ?>">
Read More »
</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</article>
<!-- 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; ?>
<!-- Recommended Blogs -->
<?php $recommendedBlogs = $listing->recommendedBlogs(3); ?>
<?= template()->include('frontend/custom/jobs/partials/recommended-blogs', [
'recommendedBlogs' => $recommendedBlogs
]) ?>
</div>
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.