Why page vs. $page

I’m not clear on why the following

$items = page('somepage')->children()->visible();

works and

$items = $page('somepage')->children()->visible();

does not. where in the docs does it mention page (without the $)?

Any insight would be helpful. Thanks.

I don’t know if you can find this anywhere in the docs. However, $page always refers to the current page, unless set otherwise in your templates/controllers.

In fact $page('somepage') wouldn’t work at all. You probably meant $page as @texnixe already pointed out.

The page() method is a shortcut to find any other page of the site. So whenever you want to work with any other page object than the current page, you can use the page() method.

Thanks for the quick response guys.

So is this page() method a shortcut for $pages->find()?

I don’t see any reference to this page() method and wonder what other gems are out there that I could use.

You can find all the helper methods like page() here: https://getkirby.com/docs/cheatsheet#helpers

Great. Thanks for the resource. I should have dug a little further down that page.