Questions concerning PrevNext and num

Hello, I have two questions as I try to have a Prev Next to my Productions

  • The first one, I use french as language, so I add num: '{{ page.calendrier.toDate("%Y%m%d") }}' to get the date from a structure calendrier, but it print the date wrongly, I tried with Ymd but then it print 0_, what is the correct syntax? Thanks
  • My page productions has 2 listed children production (those I want to appear in the PrevNext pagination) and collections (those I don’t want to appear). The Prevnext pagination is working (with the 0_title… the chronological order is wrong though), but I lack understanding because the first or last production item will always have a collections item comming next or prev. I try to filterBy template collection but it didn’t work. Is it wrong to have those two listed children in the same page? I am confused
    Thank you in advance

Are we talking about pagination or the $page->prev()/$page->next() methods here?

Helo texnixe, (hope you’re doing great), I’m using $page->hasPrevListed method

You can pass the filtered collection (i.e. children filtered by template production) as parameter to those methods. Then it only moves between these selected pages.

Thanks and sorry, I try my best but still not good.
From the page production I call the snippet prevnext
<?php snippet('prevnext', ['productions' => collection('productions')]) ?>

and my snippet look like that

<?php foreach($productions as $production): ?>
    <?php if ($production->hasPrevListed()): ?>
    <h3><a href="<?= $production->prevListed()->url() ?>">&larr; <?= $production->prevListed()->title() ?></a></h3>
    <?php endif ?>
<?php endforeach ?>

and the productions collection

return function () {
    return page('productions')
        ->sortBy('calendrier', 'desc')
        ->filterBy('template', 'production', ',');

I feel stupid, the prev and next are printing all the production pages with template production and I don’t know how to do it… if you can help me I really appreciate as you can see I’m still struggling with collection

<?php if ($prev = $production->hasPrevListed($productions)): ?>
    <h3><a href="<?= $prev->url() ?>">&larr; <?= $prev->title() ?></a></h3>
<?php endif ?>

Same for next().

[quote=“texnixe, post:6, topic:24762”]

Thank you texnixe, it’s not working. I suppose I must keep the foreach $productions as $production, but without result. When I echo the $prev I’ve got a serie of 1.
I will study more the starterkit this weekend, good weekend.