Can't query subpages of a page

Today I’ve run into a very strange issue I have never seen before. I have a basic site with the following structure:

I have two templates, default.php and gallery.php. Now, at the gallery-template, I want to access one particular subpage – for example, galerie/events. But everything I try fails:

// Returns false
var_dump(page('galerie/events'));

// Returns the correct output
var_dump(page('galerie'));

// Returns false
var_dump(page('galerie')->find('events'));

Also tried with all the other subpages, fails everytime. First-level is no problem. I can also get the page via page('galerie')->children()->first() – so why is everything else not working?

Really struggling with myself at the moment, this seems as I just forgot the most basic stuff, but I can’t see what it is. Exactly the same functions runs usually within all my sites, so no problem here. The site is running on PHP 7.0, Kirby 2.2.3 (panel, kirby, toolkit), MAMP Pro on OS X 10.11 – but as the other sites are running also locally, it doesn’t seem like an environmental problem.

Do other top-level pages work? Meaning getting a subpage of a page other than galerie?
Do you have any plugins installed? Have you verified that the subpages actually exist on the env you tested on?

Yep, everything else works – but I found the issue – I’ve overwritten the $page->id() of the subpages with a model. Now it works, thanks!

1 Like

Ah, that makes sense. Thanks for the information.