Different showcase on several project pages


#1

Hi ,
sorry maybe this is a simple question …
I have in my menu two projects pages (first called “projects”, second “wip”).
I those two projects pages I host several article, pages. But when I run my kirby,
the showcase file display the same pics gallery on these two projects page.
How can I do to have two different gallery ?

thank you so much for your precious help :slight_smile:


#2

The showcase.php snippets defines in line 3 to get the projects from the project page. You would have to change that to get the children from the current page instead.

This is line 3 of showcase.php:

$projects = page('projects')->children()->visible();

#3

perfect, thank you so much for that quick answer.
So can we have several showcase.php file (one for each new projects pages ?).

best.


#4

You can only have one file with the same name, of course.

But: you can use the same snippet in different templates; all you need to do is pass it the correct variables (see Passing Variables to Snippets in the docs). That is in fact the whole idea of snippets, i.e. being able to reuse code snippets.

If you need different snippets - because you want a different markup - you can, of course, create other snippets (with a different name).


#5

thanks for that, I will test it :wink: