How to access contents of only one particular folder/page?

Sorry for this newbie-question:

How do I access/grab the content of a particular folder/page?

On your “one-pager” example you parse through all the visible folders and display the content with foreach. How would the code line look like if I want to access e.g. the titles of the subpages in the “projects”-folder of the one-pager example or only of one specific page?

Thanks!

You can grab a specific page on the first level like this:

page('projects');
page('projects')->title();

To get the children of the projects page:

$pages = page('projects')->children();
foreach($pages as $page) {
echo $page->title();
//or whatever
}

Hey,

you could use the page helper: http://getkirby.com/docs/cheatsheet/helpers/page
So instead of
foreach($pages->visible() as $section) {
you could replace $pages->visible() by page('projects')->children()->visible()

foreach(page('projects')->children()->visible() as $section) {`

Wow, thanks for your fast replies!
:slight_smile: