More than one showcase but fetching from same Projects subpage

I want an image showcase with links to the subpages for Services, a different one for Projects, and a different one for Team. When I try to make a new image carousel, say for Services, it just fetches links and images from the original Projects subpages and not from the Services subpages. I made a new template for Services but when I look at the code, I don’t see what to edit, here it is below:

 <?php snippet('header') ?>

<?php snippet('intro') ?>

<div class="content-container">
    <?php
        // Select what type of content you'd like to display
        $projects = page('services')->children()->visible()->sortBy('manually')->paginate( (int)(string)$site->paginationServices() );
        $pagination = $items->pagination();

        // Select the listing view you'd like to use
        snippet('listing-thumbs',[ 'items' => $items ]);
    ?>
    <div class="wrap">
        <?php snippet('pagination', [ 'pagination' => $pagination ]); ?>
    </div>
</div>


<?php snippet('footer') ?>

You define $projectsin the first line here, but then you all of a sudden call the pagination method on a non-defined $items variable, which you later send to the snippet.

I changed the first appearance of $projects back to $items. Still having the same issue, where the Projects subpages appear on the Services page where I actually want the Services subpages to appear.

I think I’m not quite getting it. Are you using this same template for different pages? If you always call page('services') then you will always only get the children of that page.

So, let’s start from the beginning: Do you want all these different showcases on the same page? Or each on their own page?

Each on their own page.

Here is one showcase that is working correctly- the Projects page, displaying Project 1, Project 2 etc.

Here is one that is not- the Services page, displaying Project 1 Project 2 when I want it to be Service 1, Service 2. etc.

In this case just use $page instead of specifying a specific page, that will of course always be the same

$items = $page->children()->visible()->...;

$page always refers to the current page.

I changed it to:

 $items = $page->children()->visible()->sortBy('manually')->paginate( (int)(string)$site->paginationProjects() );
    $pagination = $items->pagination();

but it still fetches images & links from the Projects subpages

Are these pages all using the same template, i.e. the projects page and the services page all have the same content .txt file name?

What is in that snippet you are calling? Maybe you have redefined your collection there?

The code above is all from the services.php template, the services page has its own content .txt file name separate from the projects. The snippet I’m calling is accordian.php which I understand as the image carousel thing- when I look at it, I do not see any defined pages. I’m not a coder and just using the kirby kollapse template. What do you mean by collection?

Could you just zip your project and upload it to some cloud storage, then send me a PM with a link to it. Doesn’t seem to have much sense to sort it out without actually seeing what is happening.