Hey guys I’ve pretty much followed the tutorials only to make it easier for my clients, I’ve used sub pages as a way of dividing categories, so I then use grandChildren to list them all on the same page, can I paginate normally like this, and if so where have I gone wrong in my code? Thanks - Josh
<section id="vehicles">
<div class="container-fluid">
<div class="row p-0 p-lg-5">
<?php foreach ($page
->grandChildren()
->listed()
->paginate(1)
->sortBy('price', "desc")
as $vehicles) :
?>
<div class="col-12 col-lg-6 col-xl-3 p-4 p-lg-3 vehicle-card">
<a href="<?= $vehicles->url() ?>">
<div class="card">
<img class="card-img-top" src="<?= $vehicles->images()->findBy("template", "cover")->crop(520, 311)->url() ?>" alt="Card image cap">
<div class="card-body my-2 mx-3">
<h3 class="card-title"><?= $vehicles->title() ?></h3>
<span class="card-text"><?= $vehicles->spec() ?></span>
<br />
<span class="info"><?= $vehicles->fueltype() ?></span>
<span class="info"><?= $vehicles->mileage() ?></span>
<span class="info mb-4"><?= $vehicles->gearbox() ?></span>
<br />
<span class="price">
£<?= number_format($vehicles->price()->toFloat(), 0, '.', ',') ?>
</span>
</div>
</div>
</a>
</div>
<?php endforeach ?>
</div>
</div>
</section>
<nav>
<a href="<?= $vehicles->pagination()->prevPageUrl() ?>" aria-label="Go to previous page">←</a>
<a href="<?= $vehicles->pagination()->nextPageUrl() ?>" aria-label="Go to next page">→</a>
</nav>
/page:2 also is not being generated, or at least says “error no template assigned”